From a668ccfa90242ddc7abdb7a9162b8f190b62e633 Mon Sep 17 00:00:00 2001 From: Andre Rummler Date: Sat, 8 Aug 2026 21:29:17 +0200 Subject: [PATCH] Migrating the remaining signal/slot connects with an ambigious activated(int) via qOverload, since QComboBox::activated(QString) still exists pre-Qt6 and makes &QComboBox::activated alone ambiguous: - StyleEditor: outline_color/line_style/size_weight/filling_color, both connect (activeConnections(true)) and disconnect (activeConnections(false)) branches. antialiasing's stateChanged(int) connect modernized alongside them (single signal, no disambiguation needed). - TitleBlockTemplateCellWidget: cell_type_input_ (two connects to different slots), horiz_align_input_, vert_align_input_, logo_input_. Also modernises QETApp's system tray connect. In two cases stateChanged already replaced with version guarded checkStateChanged for future proofing. --- sources/editor/styleeditor.cpp | 28 +++++++++++++++-------- sources/exportdialog.cpp | 12 +++++----- sources/qetapp.cpp | 3 +-- sources/qtextorientationspinboxwidget.cpp | 6 ++--- sources/titleblock/templatecellwidget.cpp | 12 +++++----- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 1818e8bf5..30a318e3d 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -582,17 +582,25 @@ bool StyleEditor::isStyleEditable(QList cep_list) */ void StyleEditor::activeConnections(bool active) { if (active) { - connect (outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor())); - connect(line_style, SIGNAL(activated(int)), this, SLOT(updatePartLineStyle())); - connect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight())); - connect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling())); - connect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing())); + connect(outline_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartColor); + connect(line_style, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle); + connect(size_weight, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight); + connect(filling_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartFilling); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO Qt 6.7: remove, checkStateChanged() always available + connect(antialiasing, &QCheckBox::stateChanged, this, &StyleEditor::updatePartAntialiasing); +#else + connect(antialiasing, &QCheckBox::checkStateChanged, this, &StyleEditor::updatePartAntialiasing); +#endif } else { - disconnect(outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor())); - disconnect(line_style, SIGNAL(activated(int)), this, SLOT(updatePartLineStyle())); - disconnect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight())); - disconnect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling())); - disconnect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing())); + disconnect(outline_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartColor); + disconnect(line_style, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle); + disconnect(size_weight, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight); + disconnect(filling_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartFilling); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO Qt 6.7: remove, checkStateChanged() always available + disconnect(antialiasing, &QCheckBox::stateChanged, this, &StyleEditor::updatePartAntialiasing); +#else + disconnect(antialiasing, &QCheckBox::checkStateChanged, this, &StyleEditor::updatePartAntialiasing); +#endif } } diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 860b6ce6d..47eec0f55 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -181,18 +181,18 @@ QWidget *ExportDialog::initDiagramsListPart() height_mapper_ -> setMapping(diagram_line -> height, line_count); ratio_mapper_ -> setMapping(diagram_line -> keep_ratio, line_count); reset_mapper_ -> setMapping(diagram_line -> reset_size, line_count); - connect(diagram_line -> width, SIGNAL(valueChanged(int)), width_mapper_, SLOT(map())); - connect(diagram_line -> height, SIGNAL(valueChanged(int)), height_mapper_, SLOT(map())); - connect(diagram_line -> keep_ratio, SIGNAL(toggled(bool)), ratio_mapper_, SLOT(map())); - connect(diagram_line -> reset_size, SIGNAL(clicked(bool)), reset_mapper_, SLOT(map())); + connect(diagram_line -> width, qOverload(&QSpinBox::valueChanged), width_mapper_, qOverload<>(&QSignalMapper::map)); + connect(diagram_line -> height, qOverload(&QSpinBox::valueChanged), height_mapper_, qOverload<>(&QSignalMapper::map)); + connect(diagram_line -> keep_ratio, &QPushButton::toggled, ratio_mapper_, qOverload<>(&QSignalMapper::map)); + connect(diagram_line -> reset_size, &QPushButton::clicked, reset_mapper_, qOverload<>(&QSignalMapper::map)); // mappings et signaux pour l'apercu du schema preview_mapper_ -> setMapping(diagram_line -> preview, line_count); - connect(diagram_line -> preview, SIGNAL(clicked(bool)), preview_mapper_, SLOT(map())); + connect(diagram_line -> preview, &QPushButton::clicked, preview_mapper_, qOverload<>(&QSignalMapper::map)); // mappings et signaux pour l'export du schema vers le presse-papier clipboard_mapper_ -> setMapping(diagram_line -> clipboard, line_count); - connect(diagram_line -> clipboard, SIGNAL(clicked(bool)), clipboard_mapper_, SLOT(map())); + connect(diagram_line -> clipboard, &QPushButton::clicked, clipboard_mapper_, qOverload<>(&QSignalMapper::map)); } QWidget *widget_diagrams_list = new QWidget(); diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 7a7912fa7..f2a51bb5d 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -2419,8 +2419,7 @@ void QETApp::initSystemTray() // initialisation de l'icone du systray m_qsti = new QSystemTrayIcon(QET::Icons::QETLogo, this); m_qsti -> setToolTip(tr("QElectroTech", "systray icon tooltip")); - connect(m_qsti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(systray(QSystemTrayIcon::ActivationReason))); + connect(m_qsti, &QSystemTrayIcon::activated, this, &QETApp::systray); m_qsti -> setContextMenu(menu_systray); m_qsti -> show(); } diff --git a/sources/qtextorientationspinboxwidget.cpp b/sources/qtextorientationspinboxwidget.cpp index 14eefbb17..c2150fdf6 100644 --- a/sources/qtextorientationspinboxwidget.cpp +++ b/sources/qtextorientationspinboxwidget.cpp @@ -117,10 +117,10 @@ void QTextOrientationSpinBoxWidget::build() spin_box_ -> setSuffix("°"); // met en place les relations entre le SpinBox et le QTextOrientationWidget - connect(spin_box_, - SIGNAL(valueChanged(double)), + connect(spin_box_, + qOverload(&QDoubleSpinBox::valueChanged), orientation_widget_, - SLOT(setOrientation(double))); + &QTextOrientationWidget::setOrientation); connect(orientation_widget_, &QTextOrientationWidget::orientationChanged, spin_box_, diff --git a/sources/titleblock/templatecellwidget.cpp b/sources/titleblock/templatecellwidget.cpp index 2cbb6fbd2..c9068d140 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -148,17 +148,17 @@ void TitleBlockTemplateCellWidget::initWidgets() connect(add_logo_input_, SIGNAL(released()), this, SIGNAL(logoEditionRequested())); // handle cell modifications - connect(cell_type_input_, SIGNAL(activated(int)), this, SLOT(updateFormType(int))); - connect(cell_type_input_, SIGNAL(activated(int)), this, SLOT(editType())); + connect(cell_type_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::updateFormType); + connect(cell_type_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editType); connect(name_input_, &QLineEdit::editingFinished, this, &TitleBlockTemplateCellWidget::editName); connect(label_checkbox_, SIGNAL(clicked(bool)), this, SLOT(editLabelDisplayed())); connect(label_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editLabel); connect(value_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editValue); - connect(horiz_align_input_, SIGNAL(activated(int)), this, SLOT(editAlignment())); - connect(vert_align_input_, SIGNAL(activated(int)), this, SLOT(editAlignment())); - connect(font_size_input_, SIGNAL(valueChanged(int)), this, SLOT(editFontSize())); + connect(horiz_align_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editAlignment); + connect(vert_align_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editAlignment); + connect(font_size_input_, qOverload(&QSpinBox::valueChanged), this, &TitleBlockTemplateCellWidget::editFontSize); connect(font_adjust_input_, SIGNAL(clicked(bool)), this, SLOT(editAdjust())); - connect(logo_input_, SIGNAL(activated(int)), this, SLOT(editLogo())); + connect(logo_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editLogo); updateFormType(TitleBlockCell::TextCell); }