diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-25 13:41:04 -0400 |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-27 12:06:54 -0400 |
commit | ab8f6fdd8c9da74c22cc9f7cf3011c58f9bebd39 (patch) | |
tree | f4f4a60cb3b0fa6fdd6d1cc060ccfac20f61e95f /Source/QtDialog/FirstConfigure.cxx | |
parent | 7a4d84d8d20ea58cd5cb297b9e5decd58a80b709 (diff) | |
download | cmake-ab8f6fdd8c9da74c22cc9f7cf3011c58f9bebd39.tar.gz |
CMake GUI: Modernize signal-slot connections
Qt5 supports passing function pointers to QObject::connect(), and
prefers this over SIGNAL() and SLOT(). Modernize the connections,
stop using a deprecated signal from QComboBox, and modernize a few
QKeySequence's.
Diffstat (limited to 'Source/QtDialog/FirstConfigure.cxx')
-rw-r--r-- | Source/QtDialog/FirstConfigure.cxx | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 3c24b9b05a..918f137d09 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -47,17 +47,18 @@ StartCompilerSetup::StartCompilerSetup(QString defaultGeneratorPlatform, this->CompilerSetupOptions[0]->setChecked(true); - QObject::connect(this->CompilerSetupOptions[0], SIGNAL(toggled(bool)), this, - SLOT(onSelectionChanged(bool))); - QObject::connect(this->CompilerSetupOptions[1], SIGNAL(toggled(bool)), this, - SLOT(onSelectionChanged(bool))); - QObject::connect(this->CompilerSetupOptions[2], SIGNAL(toggled(bool)), this, - SLOT(onSelectionChanged(bool))); - QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), this, - SLOT(onSelectionChanged(bool))); - QObject::connect(this->GeneratorOptions, - SIGNAL(currentIndexChanged(QString const&)), this, - SLOT(onGeneratorChanged(QString const&))); + QObject::connect(this->CompilerSetupOptions[0], &QRadioButton::toggled, this, + &StartCompilerSetup::onSelectionChanged); + QObject::connect(this->CompilerSetupOptions[1], &QRadioButton::toggled, this, + &StartCompilerSetup::onSelectionChanged); + QObject::connect(this->CompilerSetupOptions[2], &QRadioButton::toggled, this, + &StartCompilerSetup::onSelectionChanged); + QObject::connect(this->CompilerSetupOptions[3], &QRadioButton::toggled, this, + &StartCompilerSetup::onSelectionChanged); + QObject::connect( + this->GeneratorOptions, + static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &StartCompilerSetup::onGeneratorChanged); } QFrame* StartCompilerSetup::CreateToolsetWidgets() @@ -186,8 +187,10 @@ void StartCompilerSetup::onSelectionChanged(bool on) } } -void StartCompilerSetup::onGeneratorChanged(QString const& name) +void StartCompilerSetup::onGeneratorChanged(int index) { + QString name = this->GeneratorOptions->itemText(index); + // Display the generator platform for the generators supporting it if (GeneratorsSupportingPlatform.contains(name)) { @@ -458,9 +461,9 @@ FirstConfigure::FirstConfigure() this->mStartCompilerSetupPage = new StartCompilerSetup( env_generator_platform, env_generator_toolset, this); this->setPage(Start, this->mStartCompilerSetupPage); - QObject::connect(this->mStartCompilerSetupPage, SIGNAL(selectionChanged()), - this, SLOT(restart())); - + QObject::connect(this->mStartCompilerSetupPage, + &StartCompilerSetup::selectionChanged, this, + &FirstConfigure::restart); this->mNativeCompilerSetupPage = new NativeCompilerSetup(this); this->setPage(NativeSetup, this->mNativeCompilerSetupPage); |