diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-14 19:30:45 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-16 19:16:04 (GMT) |
commit | d471406f0b41b99579cb07770302555c138d47a0 (patch) | |
tree | ec87eb651403f400c89b4275d155f3bf56aad480 /Source/QtDialog | |
parent | 1356230b0709fe3a3d4e4ddf5615821bc2199d79 (diff) | |
download | CMake-d471406f0b41b99579cb07770302555c138d47a0.zip CMake-d471406f0b41b99579cb07770302555c138d47a0.tar.gz CMake-d471406f0b41b99579cb07770302555c138d47a0.tar.bz2 |
CMake GUI: Disable preset fields instead of hiding them
Diffstat (limited to 'Source/QtDialog')
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 13 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.ui | 6 |
2 files changed, 15 insertions, 4 deletions
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index acd32ec..7a04daa 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -43,6 +43,12 @@ #include "RegexExplorer.h" #include "WarningMessagesDialog.h" +namespace { +const QString PRESETS_DISABLED_TOOLTIP = + "This option is disabled because there are no available presets in " + "CMakePresets.json or CMakeUserPresets.json."; +} + QCMakeThread::QCMakeThread(QObject* p) : QThread(p) { @@ -92,6 +98,7 @@ CMakeSetupDialog::CMakeSetupDialog() this->ProgressBar->reset(); this->RemoveEntry->setEnabled(false); this->AddEntry->setEnabled(false); + this->Preset->setStatusTip(PRESETS_DISABLED_TOOLTIP); QByteArray p = settings.value("SplitterSizes").toByteArray(); this->Splitter->restoreState(p); @@ -696,8 +703,8 @@ void CMakeSetupDialog::updatePresets(const QVector<QCMakePreset>& presets) this->Preset->blockSignals(false); } - this->Preset->setHidden(presets.isEmpty()); - this->PresetLabel->setHidden(presets.isEmpty()); + this->Preset->setDisabled(presets.isEmpty()); + this->Preset->setToolTip(presets.isEmpty() ? PRESETS_DISABLED_TOOLTIP : ""); if (!this->DeferredPreset.isNull()) { this->Preset->setPresetName(this->DeferredPreset); @@ -823,7 +830,7 @@ void CMakeSetupDialog::setEnabledState(bool enabled) this->CacheValues->cacheModel()->setEditEnabled(enabled); this->SourceDirectory->setEnabled(enabled); this->BrowseSourceDirectoryButton->setEnabled(enabled); - this->Preset->setEnabled(enabled); + this->Preset->setEnabled(enabled && !this->Preset->presets().isEmpty()); this->BinaryDirectory->setEnabled(enabled); this->BrowseBinaryDirectoryButton->setEnabled(enabled); this->ReloadCacheAction->setEnabled(enabled); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index afb25eb..a5c35b1 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -68,7 +68,11 @@ </widget> </item> <item row="1" column="1"> - <widget class="QCMakePresetComboBox" name="Preset"/> + <widget class="QCMakePresetComboBox" name="Preset"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="BinaryLabel"> |