Utils: Remove LabelPlacement::AtCheckBoxWithoutDummyLabel

This is identical in remaining functionality to AtCheckBox after
the recent layout builder changes (or rather, can be adjusted on
the layouting side by having appropriate empty cells)

Task-number: QTCREATORBUG-29167
Change-Id: Ic357de6fb756acb5926afe1fd361ee4b18b17afd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2023-05-23 17:49:52 +02:00
parent 0234ab6896
commit 75710fa369
10 changed files with 24 additions and 32 deletions

View File

@@ -1455,18 +1455,10 @@ void BoolAspect::addToLayout(Layouting::LayoutItem &parent)
d->m_button = createSubWidget<QCheckBox>(); d->m_button = createSubWidget<QCheckBox>();
} }
switch (d->m_labelPlacement) { switch (d->m_labelPlacement) {
case LabelPlacement::AtCheckBoxWithoutDummyLabel: case LabelPlacement::AtCheckBox:
d->m_button->setText(labelText()); d->m_button->setText(labelText());
parent.addItem(d->m_button.data()); parent.addItem(d->m_button.data());
break; break;
case LabelPlacement::AtCheckBox: {
d->m_button->setText(labelText());
// FIXME:
//if (parent.isForm())
// parent.addItem(createSubWidget<QLabel>());
parent.addItem(d->m_button.data());
break;
}
case LabelPlacement::InExtraLabel: case LabelPlacement::InExtraLabel:
addLabeledItem(parent, d->m_button); addLabeledItem(parent, d->m_button);
break; break;

View File

@@ -237,7 +237,7 @@ public:
bool defaultValue() const; bool defaultValue() const;
void setDefaultValue(bool val); void setDefaultValue(bool val);
enum class LabelPlacement { AtCheckBox, AtCheckBoxWithoutDummyLabel, InExtraLabel }; enum class LabelPlacement { AtCheckBox, InExtraLabel };
void setLabel(const QString &labelText, void setLabel(const QString &labelText,
LabelPlacement labelPlacement = LabelPlacement::InExtraLabel); LabelPlacement labelPlacement = LabelPlacement::InExtraLabel);
void setLabelPlacement(LabelPlacement labelPlacement); void setLabelPlacement(LabelPlacement labelPlacement);

View File

@@ -70,25 +70,25 @@ BoostTestSettings::BoostTestSettings(Id settingsId)
registerAspect(&randomize); registerAspect(&randomize);
randomize.setSettingsKey("Randomize"); randomize.setSettingsKey("Randomize");
randomize.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); randomize.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
randomize.setLabelText(Tr::tr("Randomize")); randomize.setLabelText(Tr::tr("Randomize"));
randomize.setToolTip(Tr::tr("Randomize execution order.")); randomize.setToolTip(Tr::tr("Randomize execution order."));
registerAspect(&systemErrors); registerAspect(&systemErrors);
systemErrors.setSettingsKey("SystemErrors"); systemErrors.setSettingsKey("SystemErrors");
systemErrors.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); systemErrors.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
systemErrors.setLabelText(Tr::tr("Catch system errors")); systemErrors.setLabelText(Tr::tr("Catch system errors"));
systemErrors.setToolTip(Tr::tr("Catch or ignore system errors.")); systemErrors.setToolTip(Tr::tr("Catch or ignore system errors."));
registerAspect(&fpExceptions); registerAspect(&fpExceptions);
fpExceptions.setSettingsKey("FPExceptions"); fpExceptions.setSettingsKey("FPExceptions");
fpExceptions.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); fpExceptions.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
fpExceptions.setLabelText(Tr::tr("Floating point exceptions")); fpExceptions.setLabelText(Tr::tr("Floating point exceptions"));
fpExceptions.setToolTip(Tr::tr("Enable floating point exception traps.")); fpExceptions.setToolTip(Tr::tr("Enable floating point exception traps."));
registerAspect(&memLeaks); registerAspect(&memLeaks);
memLeaks.setSettingsKey("MemoryLeaks"); memLeaks.setSettingsKey("MemoryLeaks");
memLeaks.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); memLeaks.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
memLeaks.setDefaultValue(true); memLeaks.setDefaultValue(true);
memLeaks.setLabelText(Tr::tr("Detect memory leaks")); memLeaks.setLabelText(Tr::tr("Detect memory leaks"));
memLeaks.setToolTip(Tr::tr("Enable memory leak detection.")); memLeaks.setToolTip(Tr::tr("Enable memory leak detection."));

View File

@@ -194,7 +194,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :
m_useStaging = addAspect<BoolAspect>(); m_useStaging = addAspect<BoolAspect>();
m_useStaging->setSettingsKey(USE_STAGING_KEY); m_useStaging->setSettingsKey(USE_STAGING_KEY);
m_useStaging->setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); m_useStaging->setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
m_useStaging->setDefaultValue(!buildAndRunOnSameDevice(kit())); m_useStaging->setDefaultValue(!buildAndRunOnSameDevice(kit()));
m_stagingDir = addAspect<FilePathAspect>(); m_stagingDir = addAspect<FilePathAspect>();

View File

@@ -660,7 +660,7 @@ DebuggerSettings::DebuggerSettings()
aspect->setAutoApply(false); aspect->setAutoApply(false);
// FIXME: Make the positioning part of the LayoutBuilder later // FIXME: Make the positioning part of the LayoutBuilder later
if (auto boolAspect = dynamic_cast<BoolAspect *>(aspect)) if (auto boolAspect = dynamic_cast<BoolAspect *>(aspect))
boolAspect->setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); boolAspect->setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
}); });
} }

View File

@@ -173,7 +173,7 @@ void FakeVimSettings::setup(FvBaseAspect *aspect,
registerAspect(aspect); registerAspect(aspect);
if (auto boolAspect = dynamic_cast<FvBoolAspect *>(aspect)) if (auto boolAspect = dynamic_cast<FvBoolAspect *>(aspect))
boolAspect->setLabelPlacement(FvBoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); boolAspect->setLabelPlacement(FvBoolAspect::LabelPlacement::AtCheckBox);
#else #else
Q_UNUSED(labelText) Q_UNUSED(labelText)
#endif #endif

View File

@@ -224,7 +224,7 @@ QbsBuildStep::QbsBuildStep(BuildStepList *bsl, Utils::Id id) :
m_keepGoing->setToolTip( m_keepGoing->setToolTip(
QbsProjectManager::Tr::tr("Keep going when errors occur (if at all possible).")); QbsProjectManager::Tr::tr("Keep going when errors occur (if at all possible)."));
m_keepGoing->setLabel(QbsProjectManager::Tr::tr("Keep going"), m_keepGoing->setLabel(QbsProjectManager::Tr::tr("Keep going"),
BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); BoolAspect::LabelPlacement::AtCheckBox);
m_maxJobCount = addAspect<IntegerAspect>(); m_maxJobCount = addAspect<IntegerAspect>();
m_maxJobCount->setSettingsKey(QBS_MAXJOBCOUNT); m_maxJobCount->setSettingsKey(QBS_MAXJOBCOUNT);
@@ -235,22 +235,22 @@ QbsBuildStep::QbsBuildStep(BuildStepList *bsl, Utils::Id id) :
m_showCommandLines = addAspect<BoolAspect>(); m_showCommandLines = addAspect<BoolAspect>();
m_showCommandLines->setSettingsKey(QBS_SHOWCOMMANDLINES); m_showCommandLines->setSettingsKey(QBS_SHOWCOMMANDLINES);
m_showCommandLines->setLabel(QbsProjectManager::Tr::tr("Show command lines"), m_showCommandLines->setLabel(QbsProjectManager::Tr::tr("Show command lines"),
BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); BoolAspect::LabelPlacement::AtCheckBox);
m_install = addAspect<BoolAspect>(); m_install = addAspect<BoolAspect>();
m_install->setSettingsKey(QBS_INSTALL); m_install->setSettingsKey(QBS_INSTALL);
m_install->setValue(true); m_install->setValue(true);
m_install->setLabel(QbsProjectManager::Tr::tr("Install"), BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); m_install->setLabel(QbsProjectManager::Tr::tr("Install"), BoolAspect::LabelPlacement::AtCheckBox);
m_cleanInstallDir = addAspect<BoolAspect>(); m_cleanInstallDir = addAspect<BoolAspect>();
m_cleanInstallDir->setSettingsKey(QBS_CLEAN_INSTALL_ROOT); m_cleanInstallDir->setSettingsKey(QBS_CLEAN_INSTALL_ROOT);
m_cleanInstallDir->setLabel(QbsProjectManager::Tr::tr("Clean install root"), m_cleanInstallDir->setLabel(QbsProjectManager::Tr::tr("Clean install root"),
BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); BoolAspect::LabelPlacement::AtCheckBox);
m_forceProbes = addAspect<BoolAspect>(); m_forceProbes = addAspect<BoolAspect>();
m_forceProbes->setSettingsKey("Qbs.forceProbesKey"); m_forceProbes->setSettingsKey("Qbs.forceProbesKey");
m_forceProbes->setLabel(QbsProjectManager::Tr::tr("Force probes"), m_forceProbes->setLabel(QbsProjectManager::Tr::tr("Force probes"),
BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); BoolAspect::LabelPlacement::AtCheckBox);
m_commandLine = addAspect<StringAspect>(); m_commandLine = addAspect<StringAspect>();
m_commandLine->setDisplayStyle(StringAspect::TextEditDisplay); m_commandLine->setDisplayStyle(StringAspect::TextEditDisplay);

View File

@@ -48,7 +48,7 @@ QbsInstallStep::QbsInstallStep(BuildStepList *bsl, Utils::Id id)
setDisplayName(Tr::tr("Qbs Install")); setDisplayName(Tr::tr("Qbs Install"));
setSummaryText(Tr::tr("<b>Qbs:</b> %1").arg("install")); setSummaryText(Tr::tr("<b>Qbs:</b> %1").arg("install"));
const auto labelPlacement = BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel; const auto labelPlacement = BoolAspect::LabelPlacement::AtCheckBox;
m_dryRun = addAspect<BoolAspect>(); m_dryRun = addAspect<BoolAspect>();
m_dryRun->setSettingsKey(QBS_DRY_RUN); m_dryRun->setSettingsKey(QBS_DRY_RUN);
m_dryRun->setLabel(Tr::tr("Dry run"), labelPlacement); m_dryRun->setLabel(Tr::tr("Dry run"), labelPlacement);

View File

@@ -41,7 +41,7 @@ SubversionSettings::SubversionSettings()
registerAspect(&useAuthentication); registerAspect(&useAuthentication);
useAuthentication.setSettingsKey("Authentication"); useAuthentication.setSettingsKey("Authentication");
useAuthentication.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); useAuthentication.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
registerAspect(&userName); registerAspect(&userName);
userName.setSettingsKey("User"); userName.setSettingsKey("User");

View File

@@ -244,19 +244,19 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
filterExternalIssues.setSettingsKey(base + "FilterExternalIssues"); filterExternalIssues.setSettingsKey(base + "FilterExternalIssues");
filterExternalIssues.setDefaultValue(true); filterExternalIssues.setDefaultValue(true);
filterExternalIssues.setIcon(Icons::FILTER.icon()); filterExternalIssues.setIcon(Icons::FILTER.icon());
filterExternalIssues.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); filterExternalIssues.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
filterExternalIssues.setLabelText(Tr::tr("Show Project Costs Only")); filterExternalIssues.setLabelText(Tr::tr("Show Project Costs Only"));
filterExternalIssues.setToolTip(Tr::tr("Show only profiling info that originated from this project source.")); filterExternalIssues.setToolTip(Tr::tr("Show only profiling info that originated from this project source."));
registerAspect(&trackOrigins); registerAspect(&trackOrigins);
trackOrigins.setSettingsKey(base + "TrackOrigins"); trackOrigins.setSettingsKey(base + "TrackOrigins");
trackOrigins.setDefaultValue(true); trackOrigins.setDefaultValue(true);
trackOrigins.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); trackOrigins.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
trackOrigins.setLabelText(Tr::tr("Track origins of uninitialized memory")); trackOrigins.setLabelText(Tr::tr("Track origins of uninitialized memory"));
registerAspect(&showReachable); registerAspect(&showReachable);
showReachable.setSettingsKey(base + "ShowReachable"); showReachable.setSettingsKey(base + "ShowReachable");
showReachable.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); showReachable.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
showReachable.setLabelText(Tr::tr("Show reachable and indirectly lost blocks")); showReachable.setLabelText(Tr::tr("Show reachable and indirectly lost blocks"));
registerAspect(&leakCheckOnFinish); registerAspect(&leakCheckOnFinish);
@@ -291,12 +291,12 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
registerAspect(&enableEventToolTips); registerAspect(&enableEventToolTips);
enableEventToolTips.setDefaultValue(true); enableEventToolTips.setDefaultValue(true);
enableEventToolTips.setSettingsKey(base + "Callgrind.EnableEventToolTips"); enableEventToolTips.setSettingsKey(base + "Callgrind.EnableEventToolTips");
enableEventToolTips.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); enableEventToolTips.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
enableEventToolTips.setLabelText(Tr::tr("Show additional information for events in tooltips")); enableEventToolTips.setLabelText(Tr::tr("Show additional information for events in tooltips"));
registerAspect(&enableCacheSim); registerAspect(&enableCacheSim);
enableCacheSim.setSettingsKey(base + "Callgrind.EnableCacheSim"); enableCacheSim.setSettingsKey(base + "Callgrind.EnableCacheSim");
enableCacheSim.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); enableCacheSim.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
enableCacheSim.setLabelText(Tr::tr("Enable cache simulation")); enableCacheSim.setLabelText(Tr::tr("Enable cache simulation"));
enableCacheSim.setToolTip("<html><head/><body>" + Tr::tr( enableCacheSim.setToolTip("<html><head/><body>" + Tr::tr(
"<p>Does full cache simulation.</p>\n" "<p>Does full cache simulation.</p>\n"
@@ -310,7 +310,7 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
registerAspect(&enableBranchSim); registerAspect(&enableBranchSim);
enableBranchSim.setSettingsKey(base + "Callgrind.EnableBranchSim"); enableBranchSim.setSettingsKey(base + "Callgrind.EnableBranchSim");
enableBranchSim.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); enableBranchSim.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
enableBranchSim.setLabelText(Tr::tr("Enable branch prediction simulation")); enableBranchSim.setLabelText(Tr::tr("Enable branch prediction simulation"));
enableBranchSim.setToolTip("<html><head/><body>\n" + Tr::tr( enableBranchSim.setToolTip("<html><head/><body>\n" + Tr::tr(
"<p>Does branch prediction simulation.</p>\n" "<p>Does branch prediction simulation.</p>\n"
@@ -322,12 +322,12 @@ ValgrindBaseSettings::ValgrindBaseSettings(bool global)
registerAspect(&collectSystime); registerAspect(&collectSystime);
collectSystime.setSettingsKey(base + "Callgrind.CollectSystime"); collectSystime.setSettingsKey(base + "Callgrind.CollectSystime");
collectSystime.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); collectSystime.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
collectSystime.setLabelText(Tr::tr("Collect system call time")); collectSystime.setLabelText(Tr::tr("Collect system call time"));
collectSystime.setToolTip(Tr::tr("Collects information for system call times.")); collectSystime.setToolTip(Tr::tr("Collects information for system call times."));
registerAspect(&collectBusEvents); registerAspect(&collectBusEvents);
collectBusEvents.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel); collectBusEvents.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
collectBusEvents.setSettingsKey(base + "Callgrind.CollectBusEvents"); collectBusEvents.setSettingsKey(base + "Callgrind.CollectBusEvents");
collectBusEvents.setLabelText(Tr::tr("Collect global bus events")); collectBusEvents.setLabelText(Tr::tr("Collect global bus events"));
collectBusEvents.setToolTip(Tr::tr("Collect the number of global bus events that are executed. " collectBusEvents.setToolTip(Tr::tr("Collect the number of global bus events that are executed. "