From 5c8c940f321e3aab5101eff53d3b4fec38284afb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 12 Jan 2018 15:25:20 +0200 Subject: [PATCH] Refactoring. Backport QOverload template. --HG-- branch : develop --- .../tapepreferencesconfigurationpage.cpp | 10 +-- .../tape/dialogs/dialognewmeasurements.cpp | 4 +- src/app/tape/tmainwindow.cpp | 20 ++--- .../preferencesconfigurationpage.cpp | 8 +- .../dialogs/dialoglayoutsettings.cpp | 20 ++--- .../dialogs/dialogpatternproperties.cpp | 10 +-- .../valentina/dialogs/dialogsavelayout.cpp | 12 +-- src/app/valentina/mainwindow.cpp | 10 +-- src/libs/vmisc/backport/qoverload.h | 86 +++++++++++++++++++ src/libs/vmisc/defglobal.h | 2 + src/libs/vmisc/vmisc.pri | 3 +- .../plugins/venumproperty.cpp | 3 +- .../plugins/vlinecolorproperty.cpp | 4 +- .../plugins/vlinetypeproperty.cpp | 4 +- .../plugins/vnumberproperty.cpp | 6 +- .../plugins/vobjectproperty.cpp | 2 +- src/libs/vpropertyexplorer/vproperty.h | 1 + .../dialogs/support/dialogeditlabel.cpp | 2 +- .../vtools/dialogs/tools/dialogalongline.cpp | 4 +- .../vtools/dialogs/tools/dialogbisector.cpp | 6 +- .../dialogs/tools/dialogcubicbezier.cpp | 8 +- .../dialogs/tools/dialogcubicbezierpath.cpp | 2 +- .../dialogs/tools/dialogflippingbyaxis.cpp | 2 +- .../dialogs/tools/dialogflippingbyline.cpp | 6 +- .../vtools/dialogs/tools/dialogheight.cpp | 6 +- src/libs/vtools/dialogs/tools/dialogline.cpp | 4 +- .../dialogs/tools/dialoglineintersect.cpp | 20 ++--- .../dialogs/tools/dialoglineintersectaxis.cpp | 8 +- .../vtools/dialogs/tools/dialognormal.cpp | 4 +- .../tools/dialogpointfromcircleandtangent.cpp | 3 +- .../dialogs/tools/dialogpointofcontact.cpp | 6 +- .../tools/dialogpointofintersection.cpp | 4 +- .../tools/dialogpointofintersectionarcs.cpp | 4 +- .../dialogpointofintersectioncircles.cpp | 6 +- .../tools/dialogpointofintersectioncurves.cpp | 4 +- .../vtools/dialogs/tools/dialogrotation.cpp | 2 +- .../dialogs/tools/dialogshoulderpoint.cpp | 6 +- .../vtools/dialogs/tools/dialogspline.cpp | 4 +- .../vtools/dialogs/tools/dialogsplinepath.cpp | 2 +- .../vtools/dialogs/tools/dialogtriangle.cpp | 8 +- .../vtools/dialogs/tools/dialogtruedarts.cpp | 15 ++-- .../dialogs/tools/piece/dialoginsertnode.cpp | 2 +- .../dialogs/tools/piece/dialogpiecepath.cpp | 14 +-- .../vtools/dialogs/tools/piece/dialogpin.cpp | 2 +- .../dialogs/tools/piece/dialogplacelabel.cpp | 2 +- .../tools/piece/dialogseamallowance.cpp | 34 +++----- 46 files changed, 225 insertions(+), 170 deletions(-) create mode 100644 src/libs/vmisc/backport/qoverload.h diff --git a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp index 1a454ddae..494d3f56f 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp @@ -44,7 +44,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare ui->setupUi(this); InitLanguages(ui->langCombo); - connect(ui->langCombo, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->langCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { m_langChanged = true; }); @@ -56,7 +56,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare //---------------------- Pattern making system InitPMSystems(ui->systemCombo); ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing()); - connect(ui->systemCombo, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->systemCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { m_systemChanged = true; QString text = qApp->TrVars()->PMSystemAuthor(ui->systemCombo->currentData().toString()); @@ -98,8 +98,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare m_defGradationChanged = true; }; - connect(ui->defHeightCombo, static_cast(&QComboBox::currentIndexChanged), this, - DefGradationChanged); + connect(ui->defHeightCombo, QOverload::of(&QComboBox::currentIndexChanged), this, DefGradationChanged); ui->defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm)); index = ui->defSizeCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefSize())); @@ -107,8 +106,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare { ui->defSizeCombo->setCurrentIndex(index); } - connect(ui->defHeightCombo, static_cast(&QComboBox::currentIndexChanged), this, - DefGradationChanged); + connect(ui->defHeightCombo, QOverload::of(&QComboBox::currentIndexChanged), this, DefGradationChanged); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tape/dialogs/dialognewmeasurements.cpp b/src/app/tape/dialogs/dialognewmeasurements.cpp index 8d4cb9ba4..4e5a757f6 100644 --- a/src/app/tape/dialogs/dialognewmeasurements.cpp +++ b/src/app/tape/dialogs/dialognewmeasurements.cpp @@ -64,10 +64,10 @@ DialogNewMeasurements::DialogNewMeasurements(QWidget *parent) ui->comboBoxBaseSize->setCurrentIndex(index); } - connect(ui->comboBoxMType, static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxMType, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogNewMeasurements::CurrentTypeChanged); - connect(ui->comboBoxUnit, static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxUnit, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogNewMeasurements::CurrentUnitChanged); } diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 56a55979b..8e0b376f5 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -2014,23 +2014,20 @@ void TMainWindow::InitWindow() labelGradationHeights = new QLabel(tr("Height:")); gradationHeights = SetGradationList(labelGradationHeights, listHeights); SetDefaultHeight(static_cast(VContainer::height())); - connect(gradationHeights, static_cast(&QComboBox::currentIndexChanged), + connect(gradationHeights, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::ChangedHeight); labelGradationSizes = new QLabel(tr("Size:")); gradationSizes = SetGradationList(labelGradationSizes, listSizes); SetDefaultSize(static_cast(VContainer::size())); - connect(gradationSizes, static_cast(&QComboBox::currentIndexChanged), + connect(gradationSizes, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::ChangedSize); - connect(ui->doubleSpinBoxBaseValue, - static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxBaseValue, QOverload::of(&QDoubleSpinBox::valueChanged), this, &TMainWindow::SaveMBaseValue); - connect(ui->doubleSpinBoxInSizes, - static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxInSizes, QOverload::of(&QDoubleSpinBox::valueChanged), this, &TMainWindow::SaveMSizeIncrease); - connect(ui->doubleSpinBoxInHeights, - static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxInHeights, QOverload::of(&QDoubleSpinBox::valueChanged), this, &TMainWindow::SaveMHeightIncrease); SetDecimals(); @@ -2076,7 +2073,7 @@ void TMainWindow::InitWindow() connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &TMainWindow::SaveCustomerName); connect(ui->lineEditEmail, &QLineEdit::editingFinished, this, &TMainWindow::SaveEmail); - connect(ui->comboBoxGender, static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxGender, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::SaveGender); connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &TMainWindow::SaveBirthDate); connect(ui->pushButtonGrow, &QPushButton::clicked, this, &TMainWindow::DeployFormula); @@ -2093,7 +2090,7 @@ void TMainWindow::InitWindow() InitPMSystems(ui->comboBoxPMSystem); const qint32 index = ui->comboBoxPMSystem->findData(QLatin1Char('p')+m->PMSystem()); ui->comboBoxPMSystem->setCurrentIndex(index); - connect(ui->comboBoxPMSystem, static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxPMSystem, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::SavePMSystem); connect(ui->lineEditFind, &QLineEdit::textChanged, [this] (const QString &term){search->Find(term);}); @@ -3078,8 +3075,7 @@ void TMainWindow::InitUnits() comboBoxUnits->setCurrentIndex(indexUnit); } - connect(comboBoxUnits, static_cast(&QComboBox::currentIndexChanged), this, - &TMainWindow::PatternUnitChanged); + connect(comboBoxUnits, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::PatternUnitChanged); ui->toolBarGradation->addWidget(comboBoxUnits); } diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp index b247979a0..9308f0eca 100644 --- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp @@ -49,7 +49,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent) ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState()); InitLanguages(ui->langCombo); - connect(ui->langCombo, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->langCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { m_langChanged = true; }); @@ -60,7 +60,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent) //----------------------- Unit setup InitUnits(); - connect(ui->unitCombo, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->unitCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { m_unitChanged = true; }); @@ -73,7 +73,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent) { ui->labelCombo->setCurrentIndex(index); } - connect(ui->labelCombo, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->labelCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { m_labelLangChanged = true; }); @@ -81,7 +81,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent) //---------------------- Pattern making system InitPMSystems(ui->systemCombo); ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing()); - connect(ui->systemCombo, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->systemCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { m_systemChanged = true; QString text = qApp->TrVars()->PMSystemAuthor(ui->systemCombo->currentData().toString()); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index 96f03a7e1..c1478d323 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -71,34 +71,34 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget RestoreDefaults(); } - connect(ui->comboBoxPrinter, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxPrinter, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLayoutSettings::PrinterMargins); - connect(ui->comboBoxTemplates, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxTemplates, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLayoutSettings::TemplateSelected); - connect(ui->comboBoxPaperSizeUnit, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxPaperSizeUnit, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLayoutSettings::ConvertPaperSize); - connect(ui->doubleSpinBoxPaperWidth, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxPaperWidth, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogLayoutSettings::PaperSizeChanged); - connect(ui->doubleSpinBoxPaperHeight, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxPaperHeight, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogLayoutSettings::PaperSizeChanged); - connect(ui->doubleSpinBoxPaperWidth, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxPaperWidth, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogLayoutSettings::FindTemplate); - connect(ui->doubleSpinBoxPaperHeight, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxPaperHeight, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogLayoutSettings::FindTemplate); - connect(ui->doubleSpinBoxPaperWidth, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxPaperWidth, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogLayoutSettings::CorrectMaxFileds); - connect(ui->doubleSpinBoxPaperHeight, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxPaperHeight, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogLayoutSettings::CorrectMaxFileds); connect(ui->checkBoxIgnoreFileds, &QCheckBox::stateChanged, this, &DialogLayoutSettings::IgnoreAllFields); connect(ui->toolButtonPortrait, &QToolButton::toggled, this, &DialogLayoutSettings::Swap); connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap); - connect(ui->comboBoxLayoutUnit, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxLayoutUnit, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLayoutSettings::ConvertLayoutSize); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index d41986e8f..42aa3bfc1 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -156,10 +156,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat ui->radioButtonDefFromP->setChecked(doc->IsDefCustom()); - connect(ui->comboBoxHeight, static_cast(&QComboBox::currentIndexChanged), - this, DefValueChanged); - connect(ui->comboBoxSize, static_cast(&QComboBox::currentIndexChanged), - this, DefValueChanged); + connect(ui->comboBoxHeight, QOverload::of(&QComboBox::currentIndexChanged), this, DefValueChanged); + connect(ui->comboBoxSize, QOverload::of(&QComboBox::currentIndexChanged), this, DefValueChanged); const bool readOnly = doc->IsReadOnly(); ui->checkBoxPatternReadOnly->setChecked(readOnly); @@ -207,9 +205,9 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat VCommonSettings::PredefinedTimeFormats() + settings->GetUserDefinedTimeFormats(), doc->GetLabelTimeFormat()); - connect(ui->comboBoxDateFormat, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxDateFormat, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPatternProperties::LabelDataChanged); - connect(ui->comboBoxTimeFormat, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxTimeFormat, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPatternProperties::LabelDataChanged); } diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index 0b4d7cd2b..42153856d 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -105,7 +105,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save); connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample); - connect(ui->comboBoxFormat, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFormat, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSaveLayout::ShowExample); connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]() { @@ -141,17 +141,17 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName ReadSettings(); // connect for the template drop down box of the tiled pds - connect(ui->comboBoxTemplates, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxTemplates, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSaveLayout::WriteSettings); // connects for the margins of the tiled pdf - connect(ui->doubleSpinBoxLeftField, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxLeftField, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogSaveLayout::WriteSettings); - connect(ui->doubleSpinBoxTopField, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxTopField, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogSaveLayout::WriteSettings); - connect(ui->doubleSpinBoxRightField, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxRightField, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogSaveLayout::WriteSettings); - connect(ui->doubleSpinBoxBottomField, static_cast(&QDoubleSpinBox::valueChanged), + connect(ui->doubleSpinBoxBottomField, QOverload::of(&QDoubleSpinBox::valueChanged), this, &DialogSaveLayout::WriteSettings); // connects for the orientation buttons for the tiled pdf diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 8b3a2b6fe..1740beff7 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1907,8 +1907,7 @@ void MainWindow::ToolBarOption() // set default height SetDefaultHeight(); - connect(gradationHeights.data(), - static_cast(&QComboBox::currentIndexChanged), + connect(gradationHeights.data(), QOverload::of(&QComboBox::currentIndexChanged), this, &MainWindow::ChangedHeight); gradationSizesLabel = new QLabel(tr("Size:"), this); @@ -1917,8 +1916,7 @@ void MainWindow::ToolBarOption() // set default size SetDefaultSize(); - connect(gradationSizes.data(), - static_cast(&QComboBox::currentIndexChanged), + connect(gradationSizes.data(), QOverload::of(&QComboBox::currentIndexChanged), this, &MainWindow::ChangedSize); ui->toolBarOption->addSeparator(); @@ -1931,7 +1929,7 @@ void MainWindow::ToolBarOption() doubleSpinBoxScale->setDecimals(1); doubleSpinBoxScale->setSuffix("%"); ScaleChanged(ui->view->transform().m11()); - connect(doubleSpinBoxScale.data(), static_cast(&QDoubleSpinBox::valueChanged), + connect(doubleSpinBoxScale.data(), QOverload::of(&QDoubleSpinBox::valueChanged), this, [this](double d){ui->view->Zoom(d/100.0);}); ui->toolBarOption->addWidget(doubleSpinBoxScale); @@ -1979,7 +1977,7 @@ void MainWindow::ToolBarDraws() ui->toolBarDraws->addWidget(comboBoxDraws); comboBoxDraws->setSizeAdjustPolicy(QComboBox::AdjustToContents); comboBoxDraws->setEnabled(false); - connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), + connect(comboBoxDraws, QOverload::of(&QComboBox::currentIndexChanged), this, [this](int index){ChangePP(index);}); connect(ui->actionOptionDraw, &QAction::triggered, this, [this]() diff --git a/src/libs/vmisc/backport/qoverload.h b/src/libs/vmisc/backport/qoverload.h new file mode 100644 index 000000000..56678ac00 --- /dev/null +++ b/src/libs/vmisc/backport/qoverload.h @@ -0,0 +1,86 @@ +/************************************************************************ + ** + ** @file qoverload.h + ** @author Roman Telezhynskyi + ** @date 12 1, 2018 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2018 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef QOVERLOAD_H +#define QOVERLOAD_H + +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) +#if defined(Q_COMPILER_VARIADIC_TEMPLATES) + +template +struct QNonConstOverload +{ + template + Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr) + { return ptr; } + + template + static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr) + { return ptr; } +}; + +template +struct QConstOverload +{ + template + Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const Q_DECL_NOTHROW -> decltype(ptr) + { return ptr; } + + template + static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) Q_DECL_NOTHROW -> decltype(ptr) + { return ptr; } +}; + +template +struct QOverload : QConstOverload, QNonConstOverload +{ + using QConstOverload::of; + using QConstOverload::operator(); + using QNonConstOverload::of; + using QNonConstOverload::operator(); + + template + Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr) + { return ptr; } + + template + static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr) + { return ptr; } +}; + +#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14 +template Q_CONSTEXPR Q_DECL_UNUSED QOverload qOverload = {}; +template Q_CONSTEXPR Q_DECL_UNUSED QConstOverload qConstOverload = {}; +template Q_CONSTEXPR Q_DECL_UNUSED QNonConstOverload qNonConstOverload = {}; +#endif + +#endif // Q_COMPILER_VARIADIC_TEMPLATES +#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0) + +#endif // QOVERLOAD_H diff --git a/src/libs/vmisc/defglobal.h b/src/libs/vmisc/defglobal.h index 596b5dec9..e2be61ecd 100644 --- a/src/libs/vmisc/defglobal.h +++ b/src/libs/vmisc/defglobal.h @@ -30,6 +30,8 @@ #include +#include "backport/qoverload.h" + #define PRINTDPI 96.0 extern const qreal PrintDPI; diff --git a/src/libs/vmisc/vmisc.pri b/src/libs/vmisc/vmisc.pri index 9a8538157..e207961a2 100644 --- a/src/libs/vmisc/vmisc.pri +++ b/src/libs/vmisc/vmisc.pri @@ -35,7 +35,8 @@ HEADERS += \ $$PWD/diagnostic.h \ $$PWD/dialogs/dialogexporttocsv.h \ $$PWD/customevents.h \ - $$PWD/defglobal.h + $$PWD/defglobal.h \ + $$PWD/backport/qoverload.h # Qt's versions # 5.2.0, 5.2.1 diff --git a/src/libs/vpropertyexplorer/plugins/venumproperty.cpp b/src/libs/vpropertyexplorer/plugins/venumproperty.cpp index 022afb622..62e7b61cb 100644 --- a/src/libs/vpropertyexplorer/plugins/venumproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/venumproperty.cpp @@ -74,8 +74,7 @@ QWidget* VPE::VEnumProperty::createEditor(QWidget * parent, const QStyleOptionVi tmpEditor->setLocale(parent->locale()); tmpEditor->addItems(EnumerationLiterals); tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt()); - connect(tmpEditor, static_cast(&QComboBox::currentIndexChanged), this, - &VEnumProperty::currentIndexChanged); + connect(tmpEditor, QOverload::of(&QComboBox::currentIndexChanged), this, &VEnumProperty::currentIndexChanged); VProperty::d_ptr->editor = tmpEditor; return VProperty::d_ptr->editor; diff --git a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp index 225b1be65..196f86309 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp @@ -101,8 +101,8 @@ QWidget *VPE::VLineColorProperty::createEditor(QWidget *parent, const QStyleOpti tmpEditor->setLocale(parent->locale()); tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt()); - connect(tmpEditor, static_cast(&QComboBox::currentIndexChanged), this, - &VLineColorProperty::currentIndexChanged); + connect(tmpEditor, QOverload::of(&QComboBox::currentIndexChanged), this, + &VLineColorProperty::currentIndexChanged); VProperty::d_ptr->editor = tmpEditor; return VProperty::d_ptr->editor; diff --git a/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp index 86eb44d90..c4b4a451e 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp @@ -94,8 +94,8 @@ QWidget *VPE::VLineTypeProperty::createEditor(QWidget *parent, const QStyleOptio } tmpEditor->setCurrentIndex(VProperty::d_ptr->VariantValue.toInt()); - connect(tmpEditor, static_cast(&QComboBox::currentIndexChanged), this, - &VLineTypeProperty::currentIndexChanged); + connect(tmpEditor, QOverload::of(&QComboBox::currentIndexChanged), this, + &VLineTypeProperty::currentIndexChanged); VProperty::d_ptr->editor = tmpEditor; return VProperty::d_ptr->editor; diff --git a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp index b1cf97f08..37744c28c 100644 --- a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp @@ -62,8 +62,7 @@ QWidget* VPE::VIntegerProperty::createEditor(QWidget * parent, const QStyleOptio tmpEditor->setSingleStep(static_cast(singleStep)); tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt()); - connect(tmpEditor, static_cast(&QSpinBox::valueChanged), this, - &VIntegerProperty::valueChanged); + connect(tmpEditor, QOverload::of(&QSpinBox::valueChanged), this, &VIntegerProperty::valueChanged); VProperty::d_ptr->editor = tmpEditor; return VProperty::d_ptr->editor; @@ -170,8 +169,7 @@ QWidget* VPE::VDoubleProperty::createEditor(QWidget * parent, const QStyleOption tmpEditor->setSingleStep(singleStep); tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tmpEditor->setValue(VProperty::d_ptr->VariantValue.toDouble()); - connect(tmpEditor, static_cast(&QDoubleSpinBox::valueChanged), this, - &VIntegerProperty::valueChanged); + connect(tmpEditor, QOverload::of(&QDoubleSpinBox::valueChanged), this, &VIntegerProperty::valueChanged); VProperty::d_ptr->editor = tmpEditor; return VProperty::d_ptr->editor; diff --git a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp index 544d21601..31f3021dc 100644 --- a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp @@ -67,7 +67,7 @@ QWidget* VPE::VObjectProperty::createEditor(QWidget * parent, const QStyleOption tmpEditor->setLocale(parent->locale()); FillList(tmpEditor, objects); tmpEditor->setCurrentIndex(tmpEditor->findData(VProperty::d_ptr->VariantValue.toUInt())); - connect(tmpEditor, static_cast(&QComboBox::currentIndexChanged), this, + connect(tmpEditor, QOverload::of(&QComboBox::currentIndexChanged), this, &VObjectProperty::currentIndexChanged); VProperty::d_ptr->editor = tmpEditor; diff --git a/src/libs/vpropertyexplorer/vproperty.h b/src/libs/vpropertyexplorer/vproperty.h index 83072be60..3c23f679d 100644 --- a/src/libs/vpropertyexplorer/vproperty.h +++ b/src/libs/vpropertyexplorer/vproperty.h @@ -36,6 +36,7 @@ #include #include "vpropertyexplorer_global.h" +#include "../vmisc/backport/qoverload.h" template class QList; diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index 9ab2dbc44..448beee06 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -68,7 +68,7 @@ DialogEditLabel::DialogEditLabel(VAbstractPattern *doc, QWidget *parent) connect(ui->toolButtonNewLabel, &QToolButton::clicked, this, &DialogEditLabel::NewTemplate); connect(ui->toolButtonExportLabel, &QToolButton::clicked, this, &DialogEditLabel::ExportTemplate); connect(ui->toolButtonImportLabel, &QToolButton::clicked, this, &DialogEditLabel::ImportTemplate); - connect(ui->spinBoxFontSize, static_cast(&QSpinBox::valueChanged), this, + connect(ui->spinBoxFontSize, QOverload::of(&QSpinBox::valueChanged), this, &DialogEditLabel::SaveAdditionalFontSize); InitPlaceholders(); diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index d2db00eca..6e139545e 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -89,9 +89,9 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogAlongLine::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogAlongLine::DeployFormulaTextEdit); - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogAlongLine::PointChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogAlongLine::PointChanged); vis = new VisToolAlongLine(data); diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp index c1d807786..0ed0ca1e4 100644 --- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp +++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp @@ -82,11 +82,11 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogBisector::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogBisector::DeployFormulaTextEdit); - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogBisector::PointNameChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogBisector::PointNameChanged); - connect(ui->comboBoxThirdPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxThirdPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogBisector::PointNameChanged); vis = new VisToolBisector(data); diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp index 5caf78dda..54d8e7509 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp @@ -64,13 +64,13 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool DialogTool::CheckState(); - connect(ui->comboBoxP1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogCubicBezier::PointNameChanged); - connect(ui->comboBoxP2, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogCubicBezier::PointNameChanged); - connect(ui->comboBoxP3, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP3, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogCubicBezier::PointNameChanged); - connect(ui->comboBoxP4, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP4, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogCubicBezier::PointNameChanged); vis = new VisToolCubicBezier(data); diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp index 0ec230945..560f87428 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp @@ -76,7 +76,7 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCubicBezierPath::PointChanged); - connect(ui->comboBoxPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogCubicBezierPath::currentPointChanged); vis = new VisToolCubicBezierPath(data); diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp index 3ae02db7b..4919875fc 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp @@ -79,7 +79,7 @@ DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, const quint32 CheckState(); connect(ui->lineEditSuffix, &QLineEdit::textChanged, this, &DialogFlippingByAxis::SuffixChanged); - connect(ui->comboBoxOriginPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxOriginPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogFlippingByAxis::PointChanged); vis = new VisToolFlippingByAxis(data); diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp index d7f45068f..afdf0fe60 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp @@ -79,11 +79,9 @@ DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, const quint32 CheckState(); connect(ui->lineEditSuffix, &QLineEdit::textChanged, this, &DialogFlippingByLine::SuffixChanged); - connect(ui->comboBoxFirstLinePoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstLinePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogFlippingByLine::PointChanged); - connect(ui->comboBoxSecondLinePoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondLinePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogFlippingByLine::PointChanged); vis = new VisToolFlippingByLine(data); diff --git a/src/libs/vtools/dialogs/tools/dialogheight.cpp b/src/libs/vtools/dialogs/tools/dialogheight.cpp index 4b71d742f..73cba4626 100644 --- a/src/libs/vtools/dialogs/tools/dialogheight.cpp +++ b/src/libs/vtools/dialogs/tools/dialogheight.cpp @@ -76,11 +76,11 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge FillComboBoxLineColors(ui->comboBoxLineColor); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged); - connect(ui->comboBoxBasePoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxBasePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogHeight::PointNameChanged); - connect(ui->comboBoxP1Line, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP1Line, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogHeight::PointNameChanged); - connect(ui->comboBoxP2Line, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP2Line, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogHeight::PointNameChanged); vis = new VisToolHeight(data); diff --git a/src/libs/vtools/dialogs/tools/dialogline.cpp b/src/libs/vtools/dialogs/tools/dialogline.cpp index f48d4fa12..82625aee0 100644 --- a/src/libs/vtools/dialogs/tools/dialogline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogline.cpp @@ -64,9 +64,9 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p number = 0; - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLine::PointNameChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLine::PointNameChanged); vis = new VisToolLine(data); diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp index 19cba8c6b..3a2b3df84 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp @@ -74,13 +74,13 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 & FillComboBoxPoints(ui->comboBoxP2Line2); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged); - connect(ui->comboBoxP1Line1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP1Line1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointNameChanged); - connect(ui->comboBoxP2Line1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP2Line1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointNameChanged); - connect(ui->comboBoxP1Line2, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP1Line2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointNameChanged); - connect(ui->comboBoxP2Line2, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP2Line2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointNameChanged); vis = new VisToolLineIntersect(data); @@ -160,17 +160,13 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type) { this->setModal(true); this->show(); - connect(ui->comboBoxP1Line1, - static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxP1Line1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointChanged); - connect(ui->comboBoxP2Line1, - static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxP2Line1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointChanged); - connect(ui->comboBoxP1Line2, - static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxP1Line2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointChanged); - connect(ui->comboBoxP2Line2, - static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxP2Line2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersect::PointChanged); } } diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp index 2f56f2731..0e385b1c1 100644 --- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp +++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp @@ -91,13 +91,11 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogLineIntersectAxis::AngleTextChanged); connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::DeployAngleTextEdit); connect(timerFormula, &QTimer::timeout, this, &DialogLineIntersectAxis::EvalAngle); - connect(ui->comboBoxFirstLinePoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstLinePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersectAxis::PointNameChanged); - connect(ui->comboBoxSecondLinePoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondLinePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersectAxis::PointNameChanged); - connect(ui->comboBoxAxisPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxAxisPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogLineIntersectAxis::PointNameChanged); vis = new VisToolLineIntersectAxis(data); diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp index b043f5d82..8bf3d09c6 100644 --- a/src/libs/vtools/dialogs/tools/dialognormal.cpp +++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp @@ -84,9 +84,9 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit); - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogNormal::PointNameChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogNormal::PointNameChanged); vis = new VisToolNormal(data); diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index c320fc9b4..02b8e1a61 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -79,8 +79,7 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine FillComboBoxCrossCirclesPoints(ui->comboBoxResult); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointFromCircleAndTangent::NamePointChanged); - connect(ui->comboBoxCircleCenter, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxCircleCenter, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointFromCircleAndTangent::PointChanged); connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, diff --git a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp index bbb3c7693..d1298f60a 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp @@ -80,11 +80,11 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfContact::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogPointOfContact::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogPointOfContact::DeployFormulaTextEdit); - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfContact::PointNameChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfContact::PointNameChanged); - connect(ui->comboBoxCenter, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxCenter, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfContact::PointNameChanged); vis = new VisToolPointOfContact(data); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp index 598fa2fb9..054cfed02 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp @@ -65,9 +65,9 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con FillComboBoxPoints(ui->comboBoxSecondPoint); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged); - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersection::PointNameChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersection::PointNameChanged); vis = new VisToolPointOfIntersection(data); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp index c50a3171f..7058f1851 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp @@ -60,9 +60,9 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d FillComboBoxCrossCirclesPoints(ui->comboBoxResult); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionArcs::NamePointChanged); - connect(ui->comboBoxArc1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxArc1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersectionArcs::ArcChanged); - connect(ui->comboBoxArc1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxArc1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersectionArcs::ArcChanged); vis = new VisToolPointOfIntersectionArcs(data); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp index 40f87d315..ba7e16805 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp @@ -85,11 +85,9 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai FillComboBoxCrossCirclesPoints(ui->comboBoxResult); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCircles::NamePointChanged); - connect(ui->comboBoxCircle1Center, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxCircle1Center, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersectionCircles::PointChanged); - connect(ui->comboBoxCircle2Center, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxCircle2Center, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersectionCircles::PointChanged); connect(ui->toolButtonExprCircle1Radius, &QPushButton::clicked, this, diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp index 0668ac0ba..f8af8f572 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp @@ -63,9 +63,9 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCurves::NamePointChanged); - connect(ui->comboBoxCurve1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxCurve1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersectionCurves::CurveChanged); - connect(ui->comboBoxCurve2, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxCurve2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPointOfIntersectionCurves::CurveChanged); vis = new VisToolPointOfIntersectionCurves(data); diff --git a/src/libs/vtools/dialogs/tools/dialogrotation.cpp b/src/libs/vtools/dialogs/tools/dialogrotation.cpp index 6a4bd3274..151c907a3 100644 --- a/src/libs/vtools/dialogs/tools/dialogrotation.cpp +++ b/src/libs/vtools/dialogs/tools/dialogrotation.cpp @@ -97,7 +97,7 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogRotation::FXAngle); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogRotation::AngleChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogRotation::DeployAngleTextEdit); - connect(ui->comboBoxOriginPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxOriginPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogRotation::PointChanged); vis = new VisToolRotation(data); diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp index 397c3fe49..e4e728b5a 100644 --- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp @@ -84,11 +84,11 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 & connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogShoulderPoint::FormulaTextChanged); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogShoulderPoint::DeployFormulaTextEdit); - connect(ui->comboBoxP1Line, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP1Line, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogShoulderPoint::PointNameChanged); - connect(ui->comboBoxP2Line, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP2Line, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogShoulderPoint::PointNameChanged); - connect(ui->comboBoxP3, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP3, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogShoulderPoint::PointNameChanged); vis = new VisToolShoulderPoint(data); diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index ff4d0cee8..78373c7bd 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -111,9 +111,9 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge CheckState(); - connect(ui->comboBoxP1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSpline::PointNameChanged); - connect(ui->comboBoxP4, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxP4, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSpline::PointNameChanged); connect(ui->toolButtonExprAngle1, &QPushButton::clicked, this, &DialogSpline::FXAngle1); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index e614b1cb5..67a3d26da 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -108,7 +108,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged); - connect(ui->comboBoxPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSplinePath::currentPointChanged); connect(ui->toolButtonExprAngle1, &QPushButton::clicked, this, &DialogSplinePath::FXAngle1); diff --git a/src/libs/vtools/dialogs/tools/dialogtriangle.cpp b/src/libs/vtools/dialogs/tools/dialogtriangle.cpp index 17aff8cac..6621411a2 100644 --- a/src/libs/vtools/dialogs/tools/dialogtriangle.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtriangle.cpp @@ -67,13 +67,13 @@ DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QW FillComboBoxPoints(ui->comboBoxSecondPoint); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged); - connect(ui->comboBoxFirstPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTriangle::PointNameChanged); - connect(ui->comboBoxSecondPoint, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTriangle::PointNameChanged); - connect(ui->comboBoxAxisP1, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxAxisP1, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTriangle::PointNameChanged); - connect(ui->comboBoxAxisP2, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxAxisP2, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTriangle::PointNameChanged); vis = new VisToolTriangle(data); diff --git a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp index 989f8454a..7782c5a5c 100644 --- a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp @@ -71,20 +71,15 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, const quint32 &toolId, connect(ui->lineEditFirstNewDartPoint, &QLineEdit::textChanged, this, &DialogTrueDarts::NameDartPoint1Changed); connect(ui->lineEditSecondNewDartPoint, &QLineEdit::textChanged, this, &DialogTrueDarts::NameDartPoint2Changed); - connect(ui->comboBoxFirstBasePoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstBasePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTrueDarts::PointNameChanged); - connect(ui->comboBoxSecondBasePoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondBasePoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTrueDarts::PointNameChanged); - connect(ui->comboBoxFirstDartPoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxFirstDartPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTrueDarts::PointNameChanged); - connect(ui->comboBoxSecondDartPoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxSecondDartPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTrueDarts::PointNameChanged); - connect(ui->comboBoxThirdDartPoint, - static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxThirdDartPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogTrueDarts::PointNameChanged); vis = new VisToolTrueDarts(data); diff --git a/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp b/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp index 65e725f8f..35e4f8ad5 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialoginsertnode.cpp @@ -43,7 +43,7 @@ DialogInsertNode::DialogInsertNode(const VContainer *data, quint32 toolId, QWidg CheckPieces(); CheckItem(); - connect(ui->comboBoxPiece, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->comboBoxPiece, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { CheckPieces(); }); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index c82bf94c9..8694e63a0 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -74,7 +74,7 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabSeamAllowance)); ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPassmarks)); - connect(ui->comboBoxPiece, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->comboBoxPiece, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { ValidObjects(PathIsValid()); }); @@ -792,7 +792,7 @@ void DialogPiecePath::InitPathTab() connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogPiecePath::NameChanged); InitPathTypes(); - connect(ui->comboBoxType, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxType, QOverload::of(&QComboBox::currentIndexChanged), [this]() { ui->comboBoxPenType->setEnabled(GetType() == PiecePathType::InternalPath); @@ -826,14 +826,14 @@ void DialogPiecePath::InitSeamAllowanceTab() ui->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); InitNodesList(); - connect(ui->comboBoxNodes, static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxNodes, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPiecePath::NodeChanged); connect(ui->pushButtonDefBefore, &QPushButton::clicked, this, &DialogPiecePath::ReturnDefBefore); connect(ui->pushButtonDefAfter, &QPushButton::clicked, this, &DialogPiecePath::ReturnDefAfter); InitNodeAngles(ui->comboBoxAngle); - connect(ui->comboBoxAngle, static_cast(&QComboBox::currentIndexChanged), this, + connect(ui->comboBoxAngle, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPiecePath::NodeAngleChanged); connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPiecePath::FXWidth); @@ -857,12 +857,12 @@ void DialogPiecePath::InitSeamAllowanceTab() void DialogPiecePath::InitPassmarksTab() { InitPassmarksList(); - connect(ui->comboBoxPassmarks, static_cast(&QComboBox::currentIndexChanged), + connect(ui->comboBoxPassmarks, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogPiecePath::PassmarkChanged); - connect(ui->buttonGroupMarkType, static_cast(&QButtonGroup::buttonClicked), + connect(ui->buttonGroupMarkType, QOverload::of(&QButtonGroup::buttonClicked), this, &DialogPiecePath::PassmarkLineTypeChanged); - connect(ui->buttonGroupAngleType, static_cast(&QButtonGroup::buttonClicked), + connect(ui->buttonGroupAngleType, QOverload::of(&QButtonGroup::buttonClicked), this, &DialogPiecePath::PassmarkAngleTypeChanged); } diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpin.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpin.cpp index 6c7479ce9..88267eb14 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpin.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpin.cpp @@ -46,7 +46,7 @@ DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent) flagError = false; CheckState(); - connect(ui->comboBoxPiece, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->comboBoxPiece, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { CheckPieces(); }); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp b/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp index f53490ed6..7c6c6fad0 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp @@ -89,7 +89,7 @@ DialogPlaceLabel::DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidg connect(timerHeight, &QTimer::timeout, this, &DialogPlaceLabel::EvalHeight); connect(timerAngle, &QTimer::timeout, this, &DialogPlaceLabel::EvalAngle); - connect(ui->comboBoxPiece, static_cast(&QComboBox::currentIndexChanged), this, [this]() + connect(ui->comboBoxPiece, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { CheckPieces(); }); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index c2195dbbe..4f57f0bb8 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -2670,14 +2670,14 @@ void DialogSeamAllowance::InitSeamAllowanceTab() uiTabPaths->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); InitNodesList(); - connect(uiTabPaths->comboBoxNodes, static_cast(&QComboBox::currentIndexChanged), this, + connect(uiTabPaths->comboBoxNodes, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::NodeChanged); connect(uiTabPaths->pushButtonDefBefore, &QPushButton::clicked, this, &DialogSeamAllowance::ReturnDefBefore); connect(uiTabPaths->pushButtonDefAfter, &QPushButton::clicked, this, &DialogSeamAllowance::ReturnDefAfter); InitNodeAngles(uiTabPaths->comboBoxAngle); - connect(uiTabPaths->comboBoxAngle, static_cast(&QComboBox::currentIndexChanged), this, + connect(uiTabPaths->comboBoxAngle, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::NodeAngleChanged); uiTabPaths->listWidgetCustomSA->setContextMenuPolicy(Qt::CustomContextMenu); @@ -2685,11 +2685,11 @@ void DialogSeamAllowance::InitSeamAllowanceTab() &DialogSeamAllowance::ShowCustomSAContextMenu); connect(uiTabPaths->listWidgetCustomSA, &QListWidget::currentRowChanged, this, &DialogSeamAllowance::CustomSAChanged); - connect(uiTabPaths->comboBoxStartPoint, static_cast(&QComboBox::currentIndexChanged), + connect(uiTabPaths->comboBoxStartPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::CSAStartPointChanged); - connect(uiTabPaths->comboBoxEndPoint, static_cast(&QComboBox::currentIndexChanged), this, + connect(uiTabPaths->comboBoxEndPoint, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::CSAEndPointChanged); - connect(uiTabPaths->comboBoxIncludeType, static_cast(&QComboBox::currentIndexChanged), + connect(uiTabPaths->comboBoxIncludeType, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::CSAIncludeTypeChanged); connect(uiTabPaths->toolButtonExprWidth, &QPushButton::clicked, this, &DialogSeamAllowance::FXWidth); @@ -2804,11 +2804,9 @@ void DialogSeamAllowance::InitLabelsTab() InitPinPoint(uiTabLabels->comboBoxDLTopLeftPin); InitPinPoint(uiTabLabels->comboBoxDLBottomRightPin); - connect(uiTabLabels->comboBoxDLTopLeftPin, - static_cast(&QComboBox::currentIndexChanged), + connect(uiTabLabels->comboBoxDLTopLeftPin, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::DetailPinPointChanged); - connect(uiTabLabels->comboBoxDLBottomRightPin, - static_cast(&QComboBox::currentIndexChanged), + connect(uiTabLabels->comboBoxDLBottomRightPin, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::DetailPinPointChanged); connect(uiTabLabels->pushButtonDLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditDLFormula); @@ -2837,11 +2835,9 @@ void DialogSeamAllowance::InitLabelsTab() InitPinPoint(uiTabLabels->comboBoxPLTopLeftPin); InitPinPoint(uiTabLabels->comboBoxPLBottomRightPin); - connect(uiTabLabels->comboBoxPLTopLeftPin, - static_cast(&QComboBox::currentIndexChanged), + connect(uiTabLabels->comboBoxPLTopLeftPin, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::PatternPinPointChanged); - connect(uiTabLabels->comboBoxPLBottomRightPin, - static_cast(&QComboBox::currentIndexChanged), + connect(uiTabLabels->comboBoxPLBottomRightPin, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::PatternPinPointChanged); connect(uiTabLabels->pushButtonPLWidth, &QPushButton::clicked, this, &DialogSeamAllowance::EditPLFormula); @@ -2891,11 +2887,9 @@ void DialogSeamAllowance::InitGrainlineTab() InitPinPoint(uiTabGrainline->comboBoxGrainlineTopPin); InitPinPoint(uiTabGrainline->comboBoxGrainlineBottomPin); - connect(uiTabGrainline->comboBoxGrainlineTopPin, - static_cast(&QComboBox::currentIndexChanged), + connect(uiTabGrainline->comboBoxGrainlineTopPin, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::GrainlinePinPointChanged); - connect(uiTabGrainline->comboBoxGrainlineBottomPin, - static_cast(&QComboBox::currentIndexChanged), + connect(uiTabGrainline->comboBoxGrainlineBottomPin, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::GrainlinePinPointChanged); } @@ -2911,12 +2905,12 @@ void DialogSeamAllowance::InitPinsTab() void DialogSeamAllowance::InitPassmarksTab() { InitPassmarksList(); - connect(uiTabPassmarks->comboBoxPassmarks, static_cast(&QComboBox::currentIndexChanged), + connect(uiTabPassmarks->comboBoxPassmarks, QOverload::of(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::PassmarkChanged); - connect(uiTabPassmarks->buttonGroupLineType, static_cast(&QButtonGroup::buttonClicked), + connect(uiTabPassmarks->buttonGroupLineType, QOverload::of(&QButtonGroup::buttonClicked), this, &DialogSeamAllowance::PassmarkLineTypeChanged); - connect(uiTabPassmarks->buttonGroupAngleType, static_cast(&QButtonGroup::buttonClicked), + connect(uiTabPassmarks->buttonGroupAngleType, QOverload::of(&QButtonGroup::buttonClicked), this, &DialogSeamAllowance::PassmarkAngleTypeChanged); connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this, &DialogSeamAllowance::PassmarkShowSecondChanged);