From 39dc1e6210466ead5d430c082ab717fbdefd898c Mon Sep 17 00:00:00 2001 From: Syres916 <46537884+Syres916@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:08:51 +0100 Subject: [PATCH] =?UTF-8?q?[Gui]=20C++=20preparation=20for=20deprecation?= =?UTF-8?q?=20of=20QCheckBox=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …stateChanged -> checkStateChanged --- src/Gui/Dialogs/DlgExpressionInput.cpp | 10 ++++++++ .../DlgSettingsLightSources.cpp | 4 ++++ src/Gui/Selection/SelectionView.cpp | 4 ++++ src/Mod/Fem/Gui/TaskTetParameter.cpp | 15 +++++++++++- src/Mod/Material/Gui/MaterialSave.cpp | 5 +++- src/Mod/Measure/Gui/TaskMeasure.cpp | 5 +++- src/Mod/Sketcher/Gui/Command.cpp | 13 ++++++++++- .../Sketcher/Gui/TaskSketcherConstraints.cpp | 7 ++++++ src/Mod/Sketcher/Gui/TaskSketcherElements.cpp | 7 ++++++ .../Gui/TaskSketcherSolverAdvanced.cpp | 14 +++++++++++ .../Gui/DlgPrefsTechDrawAdvancedImp.cpp | 23 +++++++++++++++++++ src/Mod/TechDraw/Gui/TaskDimension.cpp | 20 ++++++++++++++++ 12 files changed, 123 insertions(+), 4 deletions(-) diff --git a/src/Gui/Dialogs/DlgExpressionInput.cpp b/src/Gui/Dialogs/DlgExpressionInput.cpp index 28680bcfc3..0f45d60c86 100644 --- a/src/Gui/Dialogs/DlgExpressionInput.cpp +++ b/src/Gui/Dialogs/DlgExpressionInput.cpp @@ -124,8 +124,13 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, DlgExpressionInput::~DlgExpressionInput() { +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + disconnect(ui->checkBoxVarSets, &QCheckBox::checkStateChanged, + this, &DlgExpressionInput::onCheckVarSets); +#else disconnect(ui->checkBoxVarSets, &QCheckBox::stateChanged, this, &DlgExpressionInput::onCheckVarSets); +#endif disconnect(ui->comboBoxVarSet, qOverload(&QComboBox::currentIndexChanged), this, &DlgExpressionInput::onVarSetSelected); disconnect(ui->lineEditGroup, &QLineEdit::textChanged, @@ -202,8 +207,13 @@ void DlgExpressionInput::initializeVarSets() ui->labelInfoActive->setAlignment(Qt::AlignTop | Qt::AlignLeft); ui->labelInfoActive->setWordWrap(true); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->checkBoxVarSets, &QCheckBox::checkStateChanged, + this, &DlgExpressionInput::onCheckVarSets); +#else connect(ui->checkBoxVarSets, &QCheckBox::stateChanged, this, &DlgExpressionInput::onCheckVarSets); +#endif connect(ui->comboBoxVarSet, qOverload(&QComboBox::currentIndexChanged), this, &DlgExpressionInput::onVarSetSelected); connect(ui->lineEditGroup, &QLineEdit::textChanged, diff --git a/src/Gui/PreferencePages/DlgSettingsLightSources.cpp b/src/Gui/PreferencePages/DlgSettingsLightSources.cpp index 3f6bddce8c..12d4630d8e 100644 --- a/src/Gui/PreferencePages/DlgSettingsLightSources.cpp +++ b/src/Gui/PreferencePages/DlgSettingsLightSources.cpp @@ -77,7 +77,11 @@ DlgSettingsLightSources::DlgSettingsLightSources(QWidget* parent) this, updateLightFunction); connect(colorButton, &ColorButton::changed, this, updateLightFunction); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(enabledCheckbox, &QCheckBox::checkStateChanged, this, updateLightFunction); +#else connect(enabledCheckbox, &QCheckBox::stateChanged, this, updateLightFunction); +#endif }; const auto updateLight = [&](SoDirectionalLight* light, diff --git a/src/Gui/Selection/SelectionView.cpp b/src/Gui/Selection/SelectionView.cpp index 1c1a616e52..83fc7109f2 100644 --- a/src/Gui/Selection/SelectionView.cpp +++ b/src/Gui/Selection/SelectionView.cpp @@ -111,7 +111,11 @@ SelectionView::SelectionView(Gui::Document* pcDocument, QWidget* parent) connect(pickList, &QListWidget::itemDoubleClicked, this, &SelectionView::toggleSelect); connect(pickList, &QListWidget::itemEntered, this, &SelectionView::preselect); connect(selectionView, &QListWidget::customContextMenuRequested, this, &SelectionView::onItemContextMenu); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(enablePickList, &QCheckBox::checkStateChanged, this, &SelectionView::onEnablePickList); +#else connect(enablePickList, &QCheckBox::stateChanged, this, &SelectionView::onEnablePickList); +#endif // clang-format on } diff --git a/src/Mod/Fem/Gui/TaskTetParameter.cpp b/src/Mod/Fem/Gui/TaskTetParameter.cpp index 8016febd5f..c2eed0cde9 100644 --- a/src/Mod/Fem/Gui/TaskTetParameter.cpp +++ b/src/Mod/Fem/Gui/TaskTetParameter.cpp @@ -69,10 +69,17 @@ TaskTetParameter::TaskTetParameter(Fem::FemMeshShapeNetgenObject* pcObject, QWid qOverload(&QComboBox::activated), this, &TaskTetParameter::SwitchMethod); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(ui->checkBox_SecondOrder, + &QCheckBox::checkStateChanged, + this, + &TaskTetParameter::setQuadric); +#else QObject::connect(ui->checkBox_SecondOrder, &QCheckBox::stateChanged, this, &TaskTetParameter::setQuadric); +#endif QObject::connect(ui->doubleSpinBox_GrowthRate, qOverload(&QDoubleSpinBox::valueChanged), this, @@ -85,11 +92,17 @@ TaskTetParameter::TaskTetParameter(Fem::FemMeshShapeNetgenObject* pcObject, QWid qOverload(&QSpinBox::valueChanged), this, &TaskTetParameter::setSegsPerRadius); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(ui->checkBox_Optimize, + &QCheckBox::checkStateChanged, + this, + &TaskTetParameter::setOptimize); +#else QObject::connect(ui->checkBox_Optimize, &QCheckBox::stateChanged, this, &TaskTetParameter::setOptimize); - +#endif if (pcObject->FemMesh.getValue().getInfo().numNode == 0) { touched = true; } diff --git a/src/Mod/Material/Gui/MaterialSave.cpp b/src/Mod/Material/Gui/MaterialSave.cpp index 8651cb8344..2acac7579f 100644 --- a/src/Mod/Material/Gui/MaterialSave.cpp +++ b/src/Mod/Material/Gui/MaterialSave.cpp @@ -66,8 +66,11 @@ MaterialSave::MaterialSave(const std::shared_ptr& material, _filename = QString(ui->editFilename->text()); // No filename by default ui->checkDerived->setChecked(_saveInherited); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->checkDerived, &QCheckBox::checkStateChanged, this, &MaterialSave::onInherited); +#else connect(ui->checkDerived, &QCheckBox::stateChanged, this, &MaterialSave::onInherited); - +#endif connect(ui->standardButtons->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, diff --git a/src/Mod/Measure/Gui/TaskMeasure.cpp b/src/Mod/Measure/Gui/TaskMeasure.cpp index e9dccee5d4..b15d2e8e7a 100644 --- a/src/Mod/Measure/Gui/TaskMeasure.cpp +++ b/src/Mod/Measure/Gui/TaskMeasure.cpp @@ -85,8 +85,11 @@ TaskMeasure::TaskMeasure() showDelta = new QCheckBox(); showDelta->setChecked(delta); showDeltaLabel = new QLabel(tr("Show Delta:")); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(showDelta, &QCheckBox::checkStateChanged, this, &TaskMeasure::showDeltaChanged); +#else connect(showDelta, &QCheckBox::stateChanged, this, &TaskMeasure::showDeltaChanged); - +#endif autoSaveAction = new QAction(tr("Auto Save")); autoSaveAction->setCheckable(true); autoSaveAction->setChecked(mAutoSave); diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index cbc709ef56..4a1478d339 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -1203,7 +1203,11 @@ protected: languageChange(); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(gridAutoSpacing, &QCheckBox::checkStateChanged, [this](int state) { +#else QObject::connect(gridAutoSpacing, &QCheckBox::stateChanged, [this](int state) { +#endif auto* sketchView = getView(); if (sketchView) { @@ -1459,12 +1463,19 @@ protected: languageChange(); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(snapToObjects, &QCheckBox::checkStateChanged, [this](int state) { +#else QObject::connect(snapToObjects, &QCheckBox::stateChanged, [this](int state) { +#endif ParameterGrp::handle hGrp = this->getParameterPath(); hGrp->SetBool("SnapToObjects", state == Qt::Checked); }); - +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(snapToGrid, &QCheckBox::checkStateChanged, [this](int state) { +#else QObject::connect(snapToGrid, &QCheckBox::stateChanged, [this](int state) { +#endif ParameterGrp::handle hGrp = this->getParameterPath(); hGrp->SetBool("SnapToGrid", state == Qt::Checked); }); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index 6e9ee2caa5..b7fa77f62c 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -910,10 +910,17 @@ TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch* sketchView) &ConstraintView::emitShowSelection3DVisibility, this, &TaskSketcherConstraints::onListWidgetConstraintsEmitShowSelection3DVisibility); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(ui->filterBox, + &QCheckBox::checkStateChanged, + this, + &TaskSketcherConstraints::onFilterBoxStateChanged); +#else QObject::connect(ui->filterBox, &QCheckBox::stateChanged, this, &TaskSketcherConstraints::onFilterBoxStateChanged); +#endif QObject::connect( ui->filterButton, &QToolButton::clicked, ui->filterButton, &QToolButton::showMenu); QObject::connect(ui->showHideButton, diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 336ed57f67..c649182d5c 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -1250,10 +1250,17 @@ void TaskSketcherElements::connectSignals() &QListWidget::itemChanged, this, &TaskSketcherElements::onListMultiFilterItemChanged); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + QObject::connect(ui->filterBox, + &QCheckBox::checkStateChanged, + this, + &TaskSketcherElements::onFilterBoxStateChanged); +#else QObject::connect(ui->filterBox, &QCheckBox::stateChanged, this, &TaskSketcherElements::onFilterBoxStateChanged); +#endif QObject::connect( ui->settingsButton, &QToolButton::clicked, ui->settingsButton, &QToolButton::showMenu); QObject::connect(std::as_const(ui->settingsButton)->actions()[0], diff --git a/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp b/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp index 7f1caaae1c..f61a8dbff6 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp @@ -101,10 +101,17 @@ void TaskSketcherSolverAdvanced::setupConnections() qOverload(&QSpinBox::valueChanged), this, &TaskSketcherSolverAdvanced::onSpinBoxMaxIterValueChanged); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->checkBoxSketchSizeMultiplier, + &QCheckBox::checkStateChanged, + this, + &TaskSketcherSolverAdvanced::onCheckBoxSketchSizeMultiplierStateChanged); +#else connect(ui->checkBoxSketchSizeMultiplier, &QCheckBox::stateChanged, this, &TaskSketcherSolverAdvanced::onCheckBoxSketchSizeMultiplierStateChanged); +#endif connect(ui->lineEditConvergence, &QLineEdit::editingFinished, this, @@ -129,10 +136,17 @@ void TaskSketcherSolverAdvanced::setupConnections() qOverload(&QSpinBox::valueChanged), this, &TaskSketcherSolverAdvanced::onSpinBoxRedundantSolverMaxIterationsValueChanged); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->checkBoxRedundantSketchSizeMultiplier, + &QCheckBox::checkStateChanged, + this, + &TaskSketcherSolverAdvanced::onCheckBoxRedundantSketchSizeMultiplierStateChanged); +#else connect(ui->checkBoxRedundantSketchSizeMultiplier, &QCheckBox::stateChanged, this, &TaskSketcherSolverAdvanced::onCheckBoxRedundantSketchSizeMultiplierStateChanged); +#endif connect(ui->comboBoxDebugMode, qOverload(&QComboBox::currentIndexChanged), this, diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp index 557ee38868..369f67a17f 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp @@ -199,6 +199,28 @@ void DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked() void DlgPrefsTechDrawAdvancedImp::makeBalloonBoxConnections() { +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->cbBalloonDefault, + &QCheckBox::checkStateChanged, + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonShift, + &QCheckBox::checkStateChanged, + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonControl, + &QCheckBox::checkStateChanged, + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonAlt, + &QCheckBox::checkStateChanged, + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonMeta, + &QCheckBox::checkStateChanged, + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); +#else connect(ui->cbBalloonDefault, qOverload(&QCheckBox::stateChanged), this, @@ -219,6 +241,7 @@ void DlgPrefsTechDrawAdvancedImp::makeBalloonBoxConnections() qOverload(&QCheckBox::stateChanged), this, &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); +#endif } diff --git a/src/Mod/TechDraw/Gui/TaskDimension.cpp b/src/Mod/TechDraw/Gui/TaskDimension.cpp index 8774948efd..1c85ef5cff 100644 --- a/src/Mod/TechDraw/Gui/TaskDimension.cpp +++ b/src/Mod/TechDraw/Gui/TaskDimension.cpp @@ -57,7 +57,11 @@ TaskDimension::TaskDimension(QGIViewDimension *parent, ViewProviderDimension *di // Tolerancing ui->cbTheoreticallyExact->setChecked(parent->getDimFeat()->TheoreticalExact.getValue()); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->cbTheoreticallyExact, &QCheckBox::checkStateChanged, this, &TaskDimension::onTheoreticallyExactChanged); +#else connect(ui->cbTheoreticallyExact, &QCheckBox::stateChanged, this, &TaskDimension::onTheoreticallyExactChanged); +#endif // if TheoreticalExact disable tolerances if (parent->getDimFeat()->TheoreticalExact.getValue()) { ui->cbEqualTolerance->setDisabled(true); @@ -67,7 +71,11 @@ TaskDimension::TaskDimension(QGIViewDimension *parent, ViewProviderDimension *di ui->leFormatSpecifierUnderTolerance->setDisabled(true); } ui->cbEqualTolerance->setChecked(parent->getDimFeat()->EqualTolerance.getValue()); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->cbEqualTolerance, &QCheckBox::checkStateChanged, this, &TaskDimension::onEqualToleranceChanged); +#else connect(ui->cbEqualTolerance, &QCheckBox::stateChanged, this, &TaskDimension::onEqualToleranceChanged); +#endif // if EqualTolerance overtolernace must not be negative if (parent->getDimFeat()->EqualTolerance.getValue()) ui->qsbOvertolerance->setMinimum(0.0); @@ -96,7 +104,11 @@ TaskDimension::TaskDimension(QGIViewDimension *parent, ViewProviderDimension *di ui->leFormatSpecifier->setText(qs); connect(ui->leFormatSpecifier, &QLineEdit::textChanged, this, &TaskDimension::onFormatSpecifierChanged); ui->cbArbitrary->setChecked(parent->getDimFeat()->Arbitrary.getValue()); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->cbArbitrary, &QCheckBox::checkStateChanged, this, &TaskDimension::onArbitraryChanged); +#else connect(ui->cbArbitrary, &QCheckBox::stateChanged, this, &TaskDimension::onArbitraryChanged); +#endif StringValue = parent->getDimFeat()->FormatSpecOverTolerance.getValue(); qs = QString::fromUtf8(StringValue.data(), StringValue.size()); ui->leFormatSpecifierOverTolerance->setText(qs); @@ -106,12 +118,20 @@ TaskDimension::TaskDimension(QGIViewDimension *parent, ViewProviderDimension *di connect(ui->leFormatSpecifierOverTolerance, &QLineEdit::textChanged, this, &TaskDimension::onFormatSpecifierOverToleranceChanged); connect(ui->leFormatSpecifierUnderTolerance, &QLineEdit::textChanged, this, &TaskDimension::onFormatSpecifierUnderToleranceChanged); ui->cbArbitraryTolerances->setChecked(parent->getDimFeat()->ArbitraryTolerances.getValue()); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->cbArbitraryTolerances, &QCheckBox::checkStateChanged, this, &TaskDimension::onArbitraryTolerancesChanged); +#else connect(ui->cbArbitraryTolerances, &QCheckBox::stateChanged, this, &TaskDimension::onArbitraryTolerancesChanged); +#endif // Display Style if (dimensionVP) { ui->cbArrowheads->setChecked(dimensionVP->FlipArrowheads.getValue()); +#if QT_VERSION >= QT_VERSION_CHECK(6,7,0) + connect(ui->cbArrowheads, &QCheckBox::checkStateChanged, this, &TaskDimension::onFlipArrowheadsChanged); +#else connect(ui->cbArrowheads, &QCheckBox::stateChanged, this, &TaskDimension::onFlipArrowheadsChanged); +#endif ui->dimensionColor->setColor(dimensionVP->Color.getValue().asValue()); connect(ui->dimensionColor, &ColorButton::changed, this, &TaskDimension::onColorChanged); ui->qsbFontSize->setValue(dimensionVP->Fontsize.getValue());