ClangFormat: Move ClangFormat settings page

- Move ClangFormat settings page to TabWidget in the dialog
that opens when a user press "Edit" button in the CodeStyle tab

Change-Id: Ibd285344f07a6b2b20e275f2134976c50f91a019
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Artem Sokolovskii
2021-10-07 15:08:46 +02:00
parent c2d9495b62
commit 9cb0bd94f0
5 changed files with 26 additions and 14 deletions

View File

@@ -75,25 +75,19 @@ namespace ClangFormat {
class ClangFormatStyleFactory : public CppEditor::CppCodeStylePreferencesFactory
{
Q_DECLARE_TR_FUNCTIONS(ClangFormatStyleFactory)
public:
TextEditor::CodeStyleEditorWidget *createCodeStyleEditor(
TextEditor::ICodeStylePreferences *preferences, QWidget *parent) override
{
Q_UNUSED(preferences);
if (!parent)
return new ClangFormatConfigWidget;
return new ClangFormatConfigWidget(SessionManager::startupProject());
}
QWidget *createEditor(TextEditor::ICodeStylePreferences *, QWidget *) const override
{
return nullptr;
}
TextEditor::Indenter *createIndenter(QTextDocument *doc) const override
{
return new ClangFormatIndenter(doc);
}
std::pair<QWidget *, QString> additionalTab(QWidget *parent) const override
{
if (!parent)
return {new ClangFormatConfigWidget(), tr("ClangFormat")};
return {new ClangFormatConfigWidget(SessionManager::startupProject()), tr("ClangFormat")};
}
};
static void replaceCppCodeStyle()