CMake GUI: Improve signal specification

Don't use subclasses to connect to QAbstractButton::clicked. This is
slightly dodgy, but of more immediate importance, tweaking it will allow
us to change the widget type of some QToolButton instances that should
be QPushButton.
This commit is contained in:
Matthew Woehlke
2021-01-15 11:21:07 -05:00
parent 6baffecab9
commit 0bc327a79c
3 changed files with 15 additions and 13 deletions

View File

@@ -253,7 +253,7 @@ void CMakeSetupDialog::initialize()
&QCMake::propertiesChanged, this->CacheValues->cacheModel(),
&QCMakeCacheModel::setProperties);
QObject::connect(this->ConfigureButton, &QPushButton::clicked, this,
QObject::connect(this->ConfigureButton, &QAbstractButton::clicked, this,
&CMakeSetupDialog::doConfigure);
QObject::connect(this->CMakeThread->cmakeInstance(), &QCMake::configureDone,
@@ -261,15 +261,17 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->CMakeThread->cmakeInstance(), &QCMake::generateDone,
this, &CMakeSetupDialog::exitLoop);
QObject::connect(this->GenerateButton, &QPushButton::clicked, this,
QObject::connect(this->GenerateButton, &QAbstractButton::clicked, this,
&CMakeSetupDialog::doGenerate);
QObject::connect(this->OpenProjectButton, &QPushButton::clicked, this,
QObject::connect(this->OpenProjectButton, &QAbstractButton::clicked, this,
&CMakeSetupDialog::doOpenProject);
QObject::connect(this->BrowseSourceDirectoryButton, &QPushButton::clicked,
this, &CMakeSetupDialog::doSourceBrowse);
QObject::connect(this->BrowseBinaryDirectoryButton, &QPushButton::clicked,
this, &CMakeSetupDialog::doBinaryBrowse);
QObject::connect(this->BrowseSourceDirectoryButton,
&QAbstractButton::clicked, this,
&CMakeSetupDialog::doSourceBrowse);
QObject::connect(this->BrowseBinaryDirectoryButton,
&QAbstractButton::clicked, this,
&CMakeSetupDialog::doBinaryBrowse);
QObject::connect(this->BinaryDirectory, &QComboBox::editTextChanged, this,
&CMakeSetupDialog::onBinaryDirectoryChanged);
@@ -324,12 +326,12 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->CacheValues->selectionModel(),
&QItemSelectionModel::selectionChanged, this,
&CMakeSetupDialog::selectionChanged);
QObject::connect(this->RemoveEntry, &QToolButton::clicked, this,
QObject::connect(this->RemoveEntry, &QAbstractButton::clicked, this,
&CMakeSetupDialog::removeSelectedCacheEntries);
QObject::connect(this->AddEntry, &QToolButton::clicked, this,
QObject::connect(this->AddEntry, &QAbstractButton::clicked, this,
&CMakeSetupDialog::addCacheEntry);
QObject::connect(this->Environment, &QToolButton::clicked, this,
QObject::connect(this->Environment, &QAbstractButton::clicked, this,
&CMakeSetupDialog::editEnvironment);
QObject::connect(this->WarnUninitializedAction, &QAction::triggered,

View File

@@ -106,9 +106,9 @@ EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment,
this->Environment->setSelectionMode(QAbstractItemView::ExtendedSelection);
this->Environment->setSelectionBehavior(QAbstractItemView::SelectRows);
QObject::connect(this->AddEntry, &QToolButton::clicked, this,
QObject::connect(this->AddEntry, &QAbstractButton::clicked, this,
&EnvironmentDialog::addEntry);
QObject::connect(this->RemoveEntry, &QToolButton::clicked, this,
QObject::connect(this->RemoveEntry, &QAbstractButton::clicked, this,
&EnvironmentDialog::removeSelectedEntries);
QObject::connect(this->Search, &QLineEdit::textChanged, this->m_filter,
&EnvironmentSearchFilter::setFilterFixedString);

View File

@@ -25,7 +25,7 @@ QCMakeFileEditor::QCMakeFileEditor(QWidget* p, QString var)
this->ToolButton = new QToolButton(this);
this->ToolButton->setText("...");
this->ToolButton->setCursor(QCursor(Qt::ArrowCursor));
QObject::connect(this->ToolButton, &QToolButton::clicked, this,
QObject::connect(this->ToolButton, &QAbstractButton::clicked, this,
&QCMakeFileEditor::chooseFile);
}