forked from qt-creator/qt-creator
Beautifier: Fix enabling of options
Set the path to clang-format after connecting with the path chooser,
otherwise setting the initial enabled state breaks.
Broke when inline the ui file.
Amends 4933697d9a
Fixes: QTCREATORBUG-28297
Change-Id: I4c6ff7c4515edf13569cf5cd125623005f2967ad
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -79,7 +79,6 @@ ClangFormatOptionsPageWidget::ClangFormatOptionsPageWidget(ClangFormatSettings *
|
|||||||
m_command->setCommandVersionArguments({"--version"});
|
m_command->setCommandVersionArguments({"--version"});
|
||||||
m_command->setPromptDialogTitle(
|
m_command->setPromptDialogTitle(
|
||||||
BeautifierPlugin::msgCommandPromptDialogTitle("Clang Format"));
|
BeautifierPlugin::msgCommandPromptDialogTitle("Clang Format"));
|
||||||
m_command->setFilePath(m_settings->command());
|
|
||||||
|
|
||||||
if (m_settings->usePredefinedStyle())
|
if (m_settings->usePredefinedStyle())
|
||||||
m_usePredefinedStyle->setChecked(true);
|
m_usePredefinedStyle->setChecked(true);
|
||||||
@@ -107,13 +106,16 @@ ClangFormatOptionsPageWidget::ClangFormatOptionsPageWidget(ClangFormatSettings *
|
|||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
|
|
||||||
connect(m_command, &Utils::PathChooser::validChanged, options, &QWidget::setEnabled);
|
connect(m_command, &Utils::PathChooser::validChanged, options, &QWidget::setEnabled);
|
||||||
connect(m_predefinedStyle, &QComboBox::currentTextChanged, [this](const QString &item) {
|
connect(m_predefinedStyle, &QComboBox::currentTextChanged, this, [this](const QString &item) {
|
||||||
m_fallbackStyle->setEnabled(item == "File");
|
m_fallbackStyle->setEnabled(item == "File");
|
||||||
});
|
});
|
||||||
connect(m_usePredefinedStyle, &QRadioButton::toggled, [this](bool checked) {
|
connect(m_usePredefinedStyle, &QRadioButton::toggled, this, [this](bool checked) {
|
||||||
m_fallbackStyle->setEnabled(checked && m_predefinedStyle->currentText() == "File");
|
m_fallbackStyle->setEnabled(checked && m_predefinedStyle->currentText() == "File");
|
||||||
m_predefinedStyle->setEnabled(checked);
|
m_predefinedStyle->setEnabled(checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// might trigger PathChooser::validChanged, so so after the connect above
|
||||||
|
m_command->setFilePath(m_settings->command());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangFormatOptionsPageWidget::apply()
|
void ClangFormatOptionsPageWidget::apply()
|
||||||
|
Reference in New Issue
Block a user