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:
Eike Ziller
2022-10-17 14:58:47 +02:00
parent 0264aa2a21
commit 7d8a140f05

View File

@@ -79,7 +79,6 @@ ClangFormatOptionsPageWidget::ClangFormatOptionsPageWidget(ClangFormatSettings *
m_command->setCommandVersionArguments({"--version"});
m_command->setPromptDialogTitle(
BeautifierPlugin::msgCommandPromptDialogTitle("Clang Format"));
m_command->setFilePath(m_settings->command());
if (m_settings->usePredefinedStyle())
m_usePredefinedStyle->setChecked(true);
@@ -107,13 +106,16 @@ ClangFormatOptionsPageWidget::ClangFormatOptionsPageWidget(ClangFormatSettings *
}.attachTo(this);
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");
});
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_predefinedStyle->setEnabled(checked);
});
// might trigger PathChooser::validChanged, so so after the connect above
m_command->setFilePath(m_settings->command());
}
void ClangFormatOptionsPageWidget::apply()