From 293e61abeb6e996053be049e6e65ddcb96fc921e Mon Sep 17 00:00:00 2001 From: Andre Rummler Date: Sat, 8 Aug 2026 18:37:53 +0200 Subject: [PATCH] Modernizes the signal/slot connect and solves the disambiguities of the remaining currentIndexChanged(int) connects via qOverload, since QComboBox::currentIndexChanged(QString) still exists pre-Qt6. TitleBlockTemplateLocationChooser: collections_ -> updateTemplates() (a virtual method; pointer-to-member dispatch still resolves to the TitleBlockTemplateLocationSaver override at runtime as expected) TitleBlockTemplateLocationSaver: templates_ -> updateNewName() TitleBlockPropertiesWidget: m_tbt_cb -> changeCurrentTitleBlockTemplate(int) XRefPropertiesWidget: m_type_cb -> typeChanged(), m_snap_to_cb ->enableOffsetSB(int), both connect (constructor) and disconnect(destructor) --- sources/titleblock/templatelocationchooser.cpp | 3 +-- sources/titleblock/templatelocationsaver.cpp | 2 +- sources/ui/titleblockpropertieswidget.cpp | 8 ++++---- sources/ui/xrefpropertieswidget.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sources/titleblock/templatelocationchooser.cpp b/sources/titleblock/templatelocationchooser.cpp index 7fc5ab37e..62d0ca700 100644 --- a/sources/titleblock/templatelocationchooser.cpp +++ b/sources/titleblock/templatelocationchooser.cpp @@ -98,8 +98,7 @@ void TitleBlockTemplateLocationChooser::init() templates_ = new QComboBox(); updateCollections(); - connect(collections_, SIGNAL(currentIndexChanged(int)), - this, SLOT(updateTemplates())); + connect(collections_, qOverload(&QComboBox::currentIndexChanged), this, &TitleBlockTemplateLocationChooser::updateTemplates); form_layout_ = new QFormLayout(); form_layout_ -> addRow( diff --git a/sources/titleblock/templatelocationsaver.cpp b/sources/titleblock/templatelocationsaver.cpp index 3af73cd6a..0c27b1896 100644 --- a/sources/titleblock/templatelocationsaver.cpp +++ b/sources/titleblock/templatelocationsaver.cpp @@ -80,7 +80,7 @@ void TitleBlockTemplateLocationSaver::setLocation(const TitleBlockTemplateLocati void TitleBlockTemplateLocationSaver::init() { new_name_ = new QLineEdit(); - connect(templates_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateNewName())); + connect(templates_, qOverload(&QComboBox::currentIndexChanged), this, &TitleBlockTemplateLocationSaver::updateNewName); form_layout_ -> addRow(tr("ou nouveau nom", "used in save as form"), new_name_); updateTemplates(); } diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index edce4217f..e12acfb07 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -348,10 +348,10 @@ void TitleBlockPropertiesWidget::initDialog( m_tbt_menu -> addAction(m_tbt_duplicate); ui -> m_tbt_pb -> setMenu(m_tbt_menu); - connect(ui->m_tbt_cb, - SIGNAL(currentIndexChanged(int)), - this, - SLOT(changeCurrentTitleBlockTemplate(int))); + connect(ui->m_tbt_cb, + qOverload(&QComboBox::currentIndexChanged), + this, + &TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate); if (project!= nullptr){ keys_2 = project -> folioAutoNum().keys(); diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index 7909c44df..54bebd143 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -38,8 +38,8 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash prope ui->setupUi(this); buildUi(); connect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled); - connect(ui->m_type_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged())); - connect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int))); + connect(ui->m_type_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::typeChanged); + connect(ui->m_snap_to_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::enableOffsetSB); updateDisplay(); } @@ -50,8 +50,8 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash prope XRefPropertiesWidget::~XRefPropertiesWidget() { disconnect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled); - disconnect(ui->m_type_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged())); - disconnect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int))); + disconnect(ui->m_type_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::typeChanged); + disconnect(ui->m_snap_to_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::enableOffsetSB); delete ui; }