From e4b619a48a25d00d29e1a44b96d80799a5265e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 22 Jan 2025 15:47:10 +0100 Subject: [PATCH] Removed no longer necessary qOverload usages Since we require at least Qt 5.15 and set QT_DISABLE_DEPRECATED_BEFORE, we don't need to use qOverload for selecting the right signal anymore. --- src/tiled/propertiesview.cpp | 13 ++++++------ src/tiled/propertyeditorwidgets.cpp | 32 ++++++++++++++--------------- src/tiled/propertytypeseditor.cpp | 2 +- src/tiled/variantmapproperty.cpp | 2 +- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/tiled/propertiesview.cpp b/src/tiled/propertiesview.cpp index 927a20dc56..402f8aa244 100644 --- a/src/tiled/propertiesview.cpp +++ b/src/tiled/propertiesview.cpp @@ -285,8 +285,7 @@ QWidget *IntProperty::createEditor(QWidget *parent) const QSignalBlocker blocker(spinBox); spinBox->setValue(value()); }); - connect(spinBox, qOverload(&SpinBox::valueChanged), - this, &IntProperty::setValue); + connect(spinBox, &SpinBox::valueChanged, this, &IntProperty::setValue); return widget; } @@ -305,7 +304,7 @@ QWidget *FloatProperty::createEditor(QWidget *parent) syncEditor(); connect(this, &Property::valueChanged, editor, syncEditor); - connect(editor, qOverload(&DoubleSpinBox::valueChanged), + connect(editor, &DoubleSpinBox::valueChanged, this, &FloatProperty::setValue); return editor; @@ -593,7 +592,7 @@ QWidget *FontProperty::createEditor(QWidget *parent) connect(this, &Property::valueChanged, fontComboBox, syncEditor); connect(fontComboBox, &QFontComboBox::currentFontChanged, this, syncProperty); - connect(sizeSpinBox, qOverload(&QSpinBox::valueChanged), this, syncProperty); + connect(sizeSpinBox, &QSpinBox::valueChanged, this, syncProperty); connect(bold, &QAbstractButton::toggled, this, syncProperty); connect(italic, &QAbstractButton::toggled, this, syncProperty); connect(underline, &QAbstractButton::toggled, this, syncProperty); @@ -647,8 +646,8 @@ QWidget *QtAlignmentProperty::createEditor(QWidget *parent) syncEditor(); connect(this, &Property::valueChanged, editor, syncEditor); - connect(horizontalComboBox, qOverload(&QComboBox::currentIndexChanged), this, syncProperty); - connect(verticalComboBox, qOverload(&QComboBox::currentIndexChanged), this, syncProperty); + connect(horizontalComboBox, &QComboBox::currentIndexChanged, this, syncProperty); + connect(verticalComboBox, &QComboBox::currentIndexChanged, this, syncProperty); return editor; } @@ -671,7 +670,7 @@ QWidget *BaseEnumProperty::createEnumEditor(QWidget *parent) syncEditor(); QObject::connect(this, &Property::valueChanged, editor, syncEditor); - QObject::connect(editor, qOverload(&QComboBox::currentIndexChanged), this, + QObject::connect(editor, &QComboBox::currentIndexChanged, this, [editor, this] { setValue(editor->currentData().toInt()); }); diff --git a/src/tiled/propertyeditorwidgets.cpp b/src/tiled/propertyeditorwidgets.cpp index ccf5d42023..5f2756bb9b 100644 --- a/src/tiled/propertyeditorwidgets.cpp +++ b/src/tiled/propertyeditorwidgets.cpp @@ -412,8 +412,8 @@ SizeEdit::SizeEdit(QWidget *parent) { m_heightLabel, m_heightSpinBox }, }, this); - connect(m_widthSpinBox, qOverload(&QSpinBox::valueChanged), this, &SizeEdit::valueChanged); - connect(m_heightSpinBox, qOverload(&QSpinBox::valueChanged), this, &SizeEdit::valueChanged); + connect(m_widthSpinBox, &QSpinBox::valueChanged, this, &SizeEdit::valueChanged); + connect(m_heightSpinBox, &QSpinBox::valueChanged, this, &SizeEdit::valueChanged); } void SizeEdit::setValue(const QSize &size) @@ -453,8 +453,8 @@ SizeFEdit::SizeFEdit(QWidget *parent) { m_heightLabel, m_heightSpinBox }, }, this); - connect(m_widthSpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &SizeFEdit::valueChanged); - connect(m_heightSpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &SizeFEdit::valueChanged); + connect(m_widthSpinBox, &QDoubleSpinBox::valueChanged, this, &SizeFEdit::valueChanged); + connect(m_heightSpinBox, &QDoubleSpinBox::valueChanged, this, &SizeFEdit::valueChanged); } void SizeFEdit::setValue(const QSizeF &size) @@ -482,8 +482,8 @@ PointEdit::PointEdit(QWidget *parent) { m_yLabel, m_ySpinBox }, }, this); - connect(m_xSpinBox, qOverload(&QSpinBox::valueChanged), this, &PointEdit::valueChanged); - connect(m_ySpinBox, qOverload(&QSpinBox::valueChanged), this, &PointEdit::valueChanged); + connect(m_xSpinBox, &QSpinBox::valueChanged, this, &PointEdit::valueChanged); + connect(m_ySpinBox, &QSpinBox::valueChanged, this, &PointEdit::valueChanged); } void PointEdit::setValue(const QPoint &point) @@ -517,8 +517,8 @@ PointFEdit::PointFEdit(QWidget *parent) { m_yLabel, m_ySpinBox }, }, this); - connect(m_xSpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &PointFEdit::valueChanged); - connect(m_ySpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &PointFEdit::valueChanged); + connect(m_xSpinBox, &QDoubleSpinBox::valueChanged, this, &PointFEdit::valueChanged); + connect(m_ySpinBox, &QDoubleSpinBox::valueChanged, this, &PointFEdit::valueChanged); } void PointFEdit::setValue(const QPointF &point) @@ -561,10 +561,10 @@ RectEdit::RectEdit(QWidget *parent) m_widthSpinBox->setMinimum(0); m_heightSpinBox->setMinimum(0); - connect(m_xSpinBox, qOverload(&QSpinBox::valueChanged), this, &RectEdit::valueChanged); - connect(m_ySpinBox, qOverload(&QSpinBox::valueChanged), this, &RectEdit::valueChanged); - connect(m_widthSpinBox, qOverload(&QSpinBox::valueChanged), this, &RectEdit::valueChanged); - connect(m_heightSpinBox, qOverload(&QSpinBox::valueChanged), this, &RectEdit::valueChanged); + connect(m_xSpinBox, &QSpinBox::valueChanged, this, &RectEdit::valueChanged); + connect(m_ySpinBox, &QSpinBox::valueChanged, this, &RectEdit::valueChanged); + connect(m_widthSpinBox, &QSpinBox::valueChanged, this, &RectEdit::valueChanged); + connect(m_heightSpinBox, &QSpinBox::valueChanged, this, &RectEdit::valueChanged); } void RectEdit::setValue(const QRect &rect) @@ -619,10 +619,10 @@ RectFEdit::RectFEdit(QWidget *parent) { m_heightLabel, m_heightSpinBox }, }, this); - connect(m_xSpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &RectFEdit::valueChanged); - connect(m_ySpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &RectFEdit::valueChanged); - connect(m_widthSpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &RectFEdit::valueChanged); - connect(m_heightSpinBox, qOverload(&QDoubleSpinBox::valueChanged), this, &RectFEdit::valueChanged); + connect(m_xSpinBox, &QDoubleSpinBox::valueChanged, this, &RectFEdit::valueChanged); + connect(m_ySpinBox, &QDoubleSpinBox::valueChanged, this, &RectFEdit::valueChanged); + connect(m_widthSpinBox, &QDoubleSpinBox::valueChanged, this, &RectFEdit::valueChanged); + connect(m_heightSpinBox, &QDoubleSpinBox::valueChanged, this, &RectFEdit::valueChanged); } void RectFEdit::setValue(const QRectF &rect) diff --git a/src/tiled/propertytypeseditor.cpp b/src/tiled/propertytypeseditor.cpp index 54ab4e7dc6..fabb11bcb1 100644 --- a/src/tiled/propertytypeseditor.cpp +++ b/src/tiled/propertytypeseditor.cpp @@ -998,7 +998,7 @@ void PropertyTypesEditor::addEnumProperties() mStorageTypeComboBox = new QComboBox(mUi->groupBox); mStorageTypeComboBox->addItems({ tr("String"), tr("Number") }); - connect(mStorageTypeComboBox, static_cast(&QComboBox::currentIndexChanged), + connect(mStorageTypeComboBox, &QComboBox::currentIndexChanged, this, [this] (int index) { if (index != -1) setStorageType(static_cast(index)); }); mValuesAsFlagsCheckBox = new QCheckBox(tr("Allow multiple values (flags)"), mUi->groupBox); diff --git a/src/tiled/variantmapproperty.cpp b/src/tiled/variantmapproperty.cpp index e388632ce9..d5415e2112 100644 --- a/src/tiled/variantmapproperty.cpp +++ b/src/tiled/variantmapproperty.cpp @@ -534,7 +534,7 @@ QWidget *AddValueProperty::createEditor(QWidget *parent) m_value = typeBox->currentData(); - connect(typeBox, qOverload(&QComboBox::currentIndexChanged), this, [=](int index) { + connect(typeBox, &QComboBox::currentIndexChanged, this, [=](int index) { m_value = typeBox->itemData(index); session::propertyType = typeBox->currentText(); });