From 438e2ade3a04444cd828d4efe942e20f0b8f8a67 Mon Sep 17 00:00:00 2001 From: Andre Rummler Date: Sat, 8 Aug 2026 18:25:08 +0200 Subject: [PATCH] Modernize and fix buttonClicked connects. Two QButtonGroup::buttonClicked overload-ambiguity fixes, plus cleanup of the connects sitting alongside them: TitleBlockDimensionWidget: switched from the deprecated buttonClicked(int) id-based overload to buttonClicked(QAbstractButton*), disambiguated via qOverload. The slot doesn't use the argument either way, so this is a pure modernization with no behavior change. ExportPropertiesWidget: same buttonClicked fix for exported_content_choices, plus modernized the adjacent currentIndexChanged(int) relay (disambiguated via qOverload, since QComboBox::currentIndexChanged(QString) still exists pre-Qt6) and six QCheckBox::stateChanged(int) relays (single signal, no disambiguation needed). QCheckBox::stateChanged(int) is deprecated as of Qt 6.7 in favor of checkStateChanged(Qt::CheckState), but this project has no Qt6 minor version floor pinned in CMakeLists.txt, so stateChanged(int) remains the correct unconditional choice for now. QT_VERSION_CHECK(6, 7, 0) guarded checkStateChanged was introduced to avoid future warnings. --- sources/exportpropertieswidget.cpp | 25 +++++++++++++++++-------- sources/titleblock/dimensionwidget.cpp | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/sources/exportpropertieswidget.cpp b/sources/exportpropertieswidget.cpp index b31dd3813..4c9d51308 100644 --- a/sources/exportpropertieswidget.cpp +++ b/sources/exportpropertieswidget.cpp @@ -233,12 +233,21 @@ void ExportPropertiesWidget::build() connect(button_browse, &QPushButton::released, this, &ExportPropertiesWidget::slot_chooseADirectory); // emission de signaux lors du changement de format et lors du changement de zone exportee - connect(format, SIGNAL(currentIndexChanged(int)), this, SIGNAL(formatChanged())); - connect(exported_content_choices, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(exportedAreaChanged())); - connect(draw_grid, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_border, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_titleblock, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_terminals, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_bg_transparent, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_colored_conductors, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); + connect(format, qOverload(&QComboBox::currentIndexChanged), this, &ExportPropertiesWidget::formatChanged); + connect(exported_content_choices, qOverload(&QButtonGroup::buttonClicked), this, &ExportPropertiesWidget::exportedAreaChanged); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO Qt 6.7: remove, checkStateChanged() always available + connect(draw_grid, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_border, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_titleblock, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_terminals, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_bg_transparent, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_colored_conductors, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); +#else + connect(draw_grid, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_border, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_titleblock, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_terminals, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_bg_transparent, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_colored_conductors, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); +#endif } diff --git a/sources/titleblock/dimensionwidget.cpp b/sources/titleblock/dimensionwidget.cpp index 62d20df56..228b9ad57 100644 --- a/sources/titleblock/dimensionwidget.cpp +++ b/sources/titleblock/dimensionwidget.cpp @@ -143,7 +143,7 @@ void TitleBlockDimensionWidget::initWidgets() dimension_type_ -> addButton(relative_button_, QET::RelativeToTotalLength); dimension_type_ -> addButton(remaining_button_, QET::RelativeToRemainingLength); absolute_button_ -> setChecked(true); - connect(dimension_type_, SIGNAL(buttonClicked(int)), this, SLOT(updateSpinBoxSuffix())); + connect(dimension_type_, qOverload(&QButtonGroup::buttonClicked), this, &TitleBlockDimensionWidget::updateSpinBoxSuffix); } updateSpinBoxSuffix();