From 0bc327a79ca4d875df6084d490c4fd7da315a33a Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 15 Jan 2021 11:21:07 -0500 Subject: 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. --- Source/QtDialog/CMakeSetupDialog.cxx | 22 ++++++++++++---------- Source/QtDialog/EnvironmentDialog.cxx | 4 ++-- Source/QtDialog/QCMakeWidgets.cxx | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 05518a9..7c4d96b 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -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, diff --git a/Source/QtDialog/EnvironmentDialog.cxx b/Source/QtDialog/EnvironmentDialog.cxx index d4f978c..0339d1d 100644 --- a/Source/QtDialog/EnvironmentDialog.cxx +++ b/Source/QtDialog/EnvironmentDialog.cxx @@ -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); diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index ca65d13..03d6ed1 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -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); } -- cgit v0.12 From 8aebd159fc2941b600b08535cf5ced805c185e87 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 15 Jan 2021 11:24:16 -0500 Subject: CMake GUI: Don't use QToolButton Replace QToolButton instances with QPushButton. QToolButton is only meant to be used on tool bars and some other special situations. Worse, we had a mix of QToolButton and QPushButton for things that clearly should be using the same widget. This will improve visual consistency and may fix some rendering issues. --- Source/QtDialog/CMakeSetupDialog.cxx | 1 - Source/QtDialog/CMakeSetupDialog.ui | 10 ++-------- Source/QtDialog/EnvironmentDialog.ui | 10 ++-------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 7c4d96b..0313088 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index a5c35b1..25d1cbe 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -208,7 +208,7 @@ - + Add New Entry @@ -219,13 +219,10 @@ :/Icons/Plus16.png:/Icons/Plus16.png - - Qt::ToolButtonTextBesideIcon - - + Remove Selected Entries @@ -236,9 +233,6 @@ :/Icons/Delete16.png:/Icons/Delete16.png - - Qt::ToolButtonTextBesideIcon - diff --git a/Source/QtDialog/EnvironmentDialog.ui b/Source/QtDialog/EnvironmentDialog.ui index dea7624..c0b5e9d 100644 --- a/Source/QtDialog/EnvironmentDialog.ui +++ b/Source/QtDialog/EnvironmentDialog.ui @@ -46,7 +46,7 @@ - + &Add Entry @@ -54,13 +54,10 @@ :/Icons/Plus16.png:/Icons/Plus16.png - - Qt::ToolButtonTextBesideIcon - - + &Remove Entry @@ -68,9 +65,6 @@ :/Icons/Delete16.png:/Icons/Delete16.png - - Qt::ToolButtonTextBesideIcon - -- cgit v0.12 From 15e8072859e18e8a8016f263fb25daa650295672 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 15 Jan 2021 11:25:52 -0500 Subject: CMake GUI: Use system icons when available Modify GUI to use system (theme) icons when available. This may only affect builds on Linux platforms when using the system-provided Qt, but will improve visual consistency with e.g. okay/cancel buttons which are also using the system/theme icons. This also means that the GUI will look slightly more "native" on Linux. --- Source/QtDialog/CMakeSetupDialog.ui | 4 ++-- Source/QtDialog/EnvironmentDialog.ui | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index 25d1cbe..3c4bc13 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -216,7 +216,7 @@ &Add Entry - + :/Icons/Plus16.png:/Icons/Plus16.png @@ -230,7 +230,7 @@ &Remove Entry - + :/Icons/Delete16.png:/Icons/Delete16.png diff --git a/Source/QtDialog/EnvironmentDialog.ui b/Source/QtDialog/EnvironmentDialog.ui index c0b5e9d..ed23c2c 100644 --- a/Source/QtDialog/EnvironmentDialog.ui +++ b/Source/QtDialog/EnvironmentDialog.ui @@ -51,7 +51,7 @@ &Add Entry - + :/Icons/Plus16.png:/Icons/Plus16.png @@ -62,7 +62,7 @@ &Remove Entry - + :/Icons/Delete16.png:/Icons/Delete16.png -- cgit v0.12 From 79d00c629f9029cd1d9a5e1dacbfe498779959dc Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 15 Jan 2021 11:27:52 -0500 Subject: CMake GUI: Fix rendering issue Remove style sheet from a combo box in the GUI. I have no idea why this was being set, but it causes a render glitch. Also, use a more sensible size policy on the same widget. --- Source/QtDialog/CMakeSetupDialog.ui | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index 3c4bc13..c17c414 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -84,14 +84,11 @@ - + 0 0 - - padding-left: 0 - true -- cgit v0.12