diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-11-20 11:23:30 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-12-04 11:42:22 +0000 |
commit | e57c1268ee302bd78059a13a046eade9d896c61e (patch) | |
tree | 4bf29d520d9647e028169279f957efa233ca0a95 /src/plugins/texteditor | |
parent | 18669c82152585f44c80408be97947554cd1509d (diff) |
ClangFormat: Move settings to the Code Style widget
It makes sense to unify the indenter creation by replacing
the CppCodeStylePreferencesFactory instead of removing it.
We are reusing the same options page but with different
kind of settings.
With this change wizards will no more be confused by missing
factory and will create the proper indenter.
Fixes: QTCREATORBUG-21516
Change-Id: I38964d5fa1f2257617c66a1441db723d239a3237
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
4 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/texteditor/codestyleeditor.cpp b/src/plugins/texteditor/codestyleeditor.cpp index 526ee106d61..cbf74c0a124 100644 --- a/src/plugins/texteditor/codestyleeditor.cpp +++ b/src/plugins/texteditor/codestyleeditor.cpp @@ -79,11 +79,6 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, updatePreview(); } -void CodeStyleEditor::clearMargins() -{ - m_layout->setContentsMargins(QMargins()); -} - void CodeStyleEditor::updatePreview() { QTextDocument *doc = m_preview->document(); diff --git a/src/plugins/texteditor/codestyleeditor.h b/src/plugins/texteditor/codestyleeditor.h index b90752252e7..edd04db1719 100644 --- a/src/plugins/texteditor/codestyleeditor.h +++ b/src/plugins/texteditor/codestyleeditor.h @@ -46,8 +46,6 @@ public: CodeStyleEditor(ICodeStylePreferencesFactory *factory, ICodeStylePreferences *codeStyle, QWidget *parent = nullptr); - void clearMargins(); - private: void updatePreview(); diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.cpp b/src/plugins/texteditor/icodestylepreferencesfactory.cpp index d37a9991292..245d9b695c1 100644 --- a/src/plugins/texteditor/icodestylepreferencesfactory.cpp +++ b/src/plugins/texteditor/icodestylepreferencesfactory.cpp @@ -25,6 +25,8 @@ #include "icodestylepreferencesfactory.h" +#include "codestyleeditor.h" + using namespace TextEditor; ICodeStylePreferencesFactory::ICodeStylePreferencesFactory(QObject *parent) : @@ -32,3 +34,8 @@ ICodeStylePreferencesFactory::ICodeStylePreferencesFactory(QObject *parent) : { } +QWidget *ICodeStylePreferencesFactory::createCodeStyleEditor(ICodeStylePreferences *codeStyle, + QWidget *parent) +{ + return new CodeStyleEditor(this, codeStyle, parent); +} diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.h b/src/plugins/texteditor/icodestylepreferencesfactory.h index 8fbc49e036b..43cc6edffdb 100644 --- a/src/plugins/texteditor/icodestylepreferencesfactory.h +++ b/src/plugins/texteditor/icodestylepreferencesfactory.h @@ -42,6 +42,8 @@ class TEXTEDITOR_EXPORT ICodeStylePreferencesFactory : public QObject public: explicit ICodeStylePreferencesFactory(QObject *parent = nullptr); + virtual QWidget *createCodeStyleEditor(ICodeStylePreferences *codeStyle, + QWidget *parent = nullptr); virtual Core::Id languageId() = 0; virtual QString displayName() = 0; virtual ICodeStylePreferences *createCodeStyle() const = 0; |