forked from qt-creator/qt-creator
ClangFormat: Fix preview updating
Fixed the behavior when the preview does not update when the Override checkbox was not enabled initially. Currently, the preview is updating when Override the checkbox is enabled. Fixes: QTCREATORBUG-29043 Change-Id: I8a2a6f3cd5890b66d4bffd0c84aeafb5a29fba48 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -196,4 +196,10 @@ void ClangFormatGlobalConfigWidget::apply()
|
||||
settings.write();
|
||||
}
|
||||
|
||||
void ClangFormatGlobalConfigWidget::finish()
|
||||
{
|
||||
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(
|
||||
!ClangFormatSettings::instance().overrideDefaultFile());
|
||||
}
|
||||
|
||||
} // namespace ClangFormat
|
||||
|
@@ -28,6 +28,7 @@ public:
|
||||
QWidget *parent = nullptr);
|
||||
~ClangFormatGlobalConfigWidget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
void initCheckBoxes();
|
||||
|
@@ -215,9 +215,10 @@ bool getCurrentOverriddenSettings(const Utils::FilePath &filePath)
|
||||
const ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(
|
||||
filePath);
|
||||
|
||||
return getProjectUseGlobalSettings(project)
|
||||
? ClangFormatSettings::instance().overrideDefaultFile()
|
||||
: getProjectOverriddenSettings(project);
|
||||
return getProjectUseGlobalSettings(project) ? !TextEditor::TextEditorSettings::codeStyle("Cpp")
|
||||
->currentPreferences()
|
||||
->isTemporarilyReadOnly()
|
||||
: getProjectOverriddenSettings(project);
|
||||
}
|
||||
|
||||
ClangFormatSettings::Mode getProjectIndentationOrFormattingSettings(
|
||||
|
@@ -108,6 +108,9 @@ void CodeStyleEditor::finish()
|
||||
{
|
||||
if (m_widget)
|
||||
m_widget->finish();
|
||||
|
||||
if (m_additionalGlobalSettingsWidget)
|
||||
m_additionalGlobalSettingsWidget->finish();
|
||||
}
|
||||
|
||||
} // TextEditor
|
||||
|
Reference in New Issue
Block a user