From 73c5cf29c45f4d6d098b4e52043661801a2ed499 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 22 Aug 2023 15:27:34 +0200 Subject: [PATCH] Utils: Add missing connections to validChanged FancyLineEdit and PathChoosers valid state can be asyncronously update, so users need to connect to the validChanged signal to correctly update the UI and not just to textChanged, or rawPathChanged etc. Fixes: QTCREATORBUG-29525 Change-Id: I706fef61f6228af7dae9271a146cf739c3202cc7 Reviewed-by: Orgad Shaneh --- src/plugins/cppeditor/cppcodemodelsettingspage.cpp | 1 + src/plugins/debugger/debuggerdialogs.cpp | 7 +++++-- src/plugins/gitlab/gitlabclonedialog.cpp | 4 +++- src/plugins/qmljseditor/qmljscomponentnamedialog.cpp | 7 +++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/cppeditor/cppcodemodelsettingspage.cpp b/src/plugins/cppeditor/cppcodemodelsettingspage.cpp index 58db1673348..f2a96111f41 100644 --- a/src/plugins/cppeditor/cppcodemodelsettingspage.cpp +++ b/src/plugins/cppeditor/cppcodemodelsettingspage.cpp @@ -467,6 +467,7 @@ ClangdSettingsWidget::ClangdSettingsWidget(const ClangdSettings::Data &settingsD labelSetter.setWarning(errorMessage); }; connect(&d->clangdChooser, &Utils::PathChooser::textChanged, this, updateWarningLabel); + connect(&d->clangdChooser, &Utils::PathChooser::validChanged, this, updateWarningLabel); updateWarningLabel(); connect(&d->useClangdCheckBox, &QCheckBox::toggled, diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 26fa01b1243..a222432887b 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -290,8 +290,11 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) verticalLayout->addWidget(Layouting::createHr()); verticalLayout->addWidget(d->buttonBox); - connect(d->localExecutablePathChooser, &PathChooser::rawPathChanged, - this, &StartApplicationDialog::updateState); + connect(d->localExecutablePathChooser, + &PathChooser::validChanged, + this, + &StartApplicationDialog::updateState); + connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(d->historyComboBox, &QComboBox::currentIndexChanged, diff --git a/src/plugins/gitlab/gitlabclonedialog.cpp b/src/plugins/gitlab/gitlabclonedialog.cpp index 3a061b9cc57..0a884f5249a 100644 --- a/src/plugins/gitlab/gitlabclonedialog.cpp +++ b/src/plugins/gitlab/gitlabclonedialog.cpp @@ -95,9 +95,11 @@ GitLabCloneDialog::GitLabCloneDialog(const Project &project, QWidget *parent) connect(m_pathChooser, &PathChooser::textChanged, this, [this] { m_directoryLE->validate(); - GitLabCloneDialog::updateUi(); + updateUi(); }); + connect(m_pathChooser, &PathChooser::validChanged, this, &GitLabCloneDialog::updateUi); connect(m_directoryLE, &FancyLineEdit::textChanged, this, &GitLabCloneDialog::updateUi); + connect(m_directoryLE, &FancyLineEdit::validChanged, this, &GitLabCloneDialog::updateUi); connect(m_cloneButton, &QPushButton::clicked, this, &GitLabCloneDialog::cloneProject); connect(m_cancelButton, &QPushButton::clicked, this, &GitLabCloneDialog::cancel); diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp index 91bcc0ac89d..ad7b664431c 100644 --- a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp +++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp @@ -48,10 +48,9 @@ ComponentNameDialog::ComponentNameDialog(QWidget *parent) : connect(m_buttonBox, &QDialogButtonBox::accepted, this, &ComponentNameDialog::accept); connect(m_buttonBox, &QDialogButtonBox::rejected, this, &ComponentNameDialog::reject); - connect(m_pathEdit, &Utils::PathChooser::rawPathChanged, - this, &ComponentNameDialog::validate); - connect(m_componentNameEdit, &QLineEdit::textChanged, - this, &ComponentNameDialog::validate); + connect(m_pathEdit, &Utils::PathChooser::rawPathChanged, this, &ComponentNameDialog::validate); + connect(m_pathEdit, &Utils::PathChooser::validChanged, this, &ComponentNameDialog::validate); + connect(m_componentNameEdit, &QLineEdit::textChanged, this, &ComponentNameDialog::validate); } bool ComponentNameDialog::go(QString *proposedName,