Utils: Fix inverted logic for checkableDecider

`BoolAspect::checkableDecider` was used only in CMakeProjectManager for
askBeforePresetsReload and askBeforeReConfigureInitialParams.

Now the checkbox with "Ask before presets reload" would also match with
the display of the message box.

Change-Id: I45fc7a977dbeb13df051375bd3dac36e7be7bdc4
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Cristian Adam
2023-06-15 13:36:59 +02:00
parent 0960156ada
commit 6b6b1198dd
4 changed files with 14 additions and 4 deletions

View File

@@ -1607,7 +1607,15 @@ void BoolAspect::setLabelPlacement(BoolAspect::LabelPlacement labelPlacement)
d->m_labelPlacement = labelPlacement; d->m_labelPlacement = labelPlacement;
} }
CheckableDecider BoolAspect::checkableDecider() CheckableDecider BoolAspect::askAgainCheckableDecider()
{
return CheckableDecider(
[this] { return value(); },
[this] { setValue(true); }
);
}
CheckableDecider BoolAspect::doNotAskAgainCheckableDecider()
{ {
return CheckableDecider( return CheckableDecider(
[this] { return !value(); }, [this] { return !value(); },

View File

@@ -223,7 +223,9 @@ public:
void addToLayout(Layouting::LayoutItem &parent) override; void addToLayout(Layouting::LayoutItem &parent) override;
std::function<void(QObject *)> groupChecker(); std::function<void(QObject *)> groupChecker();
Utils::CheckableDecider checkableDecider();
Utils::CheckableDecider askAgainCheckableDecider();
Utils::CheckableDecider doNotAskAgainCheckableDecider();
QAction *action() override; QAction *action() override;

View File

@@ -594,7 +594,7 @@ void CMakeBuildSettingsWidget::reconfigureWithInitialParameters()
Core::ICore::dialogParent(), Core::ICore::dialogParent(),
Tr::tr("Re-configure with Initial Parameters"), Tr::tr("Re-configure with Initial Parameters"),
Tr::tr("Clear CMake configuration and configure with initial parameters?"), Tr::tr("Clear CMake configuration and configure with initial parameters?"),
settings->askBeforeReConfigureInitialParams.checkableDecider(), settings->askBeforeReConfigureInitialParams.askAgainCheckableDecider(),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes); QMessageBox::Yes);

View File

@@ -238,7 +238,7 @@ void CMakeManager::reloadCMakePresets()
Tr::tr("Reload CMake Presets"), Tr::tr("Reload CMake Presets"),
Tr::tr("Re-generates the kits that were created for CMake presets. All manual " Tr::tr("Re-generates the kits that were created for CMake presets. All manual "
"modifications to the CMake project settings will be lost."), "modifications to the CMake project settings will be lost."),
settings->askBeforePresetsReload.checkableDecider(), settings->askBeforePresetsReload.askAgainCheckableDecider(),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Yes, QMessageBox::Yes,
QMessageBox::Yes, QMessageBox::Yes,