Migrating the remaining signal/slot connects with an ambigious activated(int) via qOverload<int>,

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.
This commit is contained in:
Andre Rummler
2026-08-08 21:29:17 +02:00
parent 79da321ddc
commit a668ccfa90
5 changed files with 34 additions and 27 deletions
+18 -10
View File
@@ -582,17 +582,25 @@ bool StyleEditor::isStyleEditable(QList<CustomElementPart *> 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<int>(&QComboBox::activated), this, &StyleEditor::updatePartColor);
connect(line_style, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle);
connect(size_weight, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight);
connect(filling_color, qOverload<int>(&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<int>(&QComboBox::activated), this, &StyleEditor::updatePartColor);
disconnect(line_style, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle);
disconnect(size_weight, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight);
disconnect(filling_color, qOverload<int>(&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
}
}
+6 -6
View File
@@ -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<int>(&QSpinBox::valueChanged), width_mapper_, qOverload<>(&QSignalMapper::map));
connect(diagram_line -> height, qOverload<int>(&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();
+1 -2
View File
@@ -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();
}
+3 -3
View File
@@ -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<double>(&QDoubleSpinBox::valueChanged),
orientation_widget_,
SLOT(setOrientation(double)));
&QTextOrientationWidget::setOrientation);
connect(orientation_widget_,
&QTextOrientationWidget::orientationChanged,
spin_box_,
+6 -6
View File
@@ -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<int>(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::updateFormType);
connect(cell_type_input_, qOverload<int>(&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<int>(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editAlignment);
connect(vert_align_input_, qOverload<int>(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editAlignment);
connect(font_size_input_, qOverload<int>(&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<int>(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editLogo);
updateFormType(TitleBlockCell::TextCell);
}