From 8256ff13a8aab1aed192bb19a08c7126ac9028ae Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Oct 2020 09:31:42 +0100 Subject: Qt Designer: Port away from deprecated QVariant::Type Change-Id: Ie0f7364454047ca7c9715f8d48814d71334a3cde Reviewed-by: Lars Knoll --- .../src/lib/shared/qdesigner_propertycommand.cpp | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/designer/src/lib/shared/qdesigner_propertycommand.cpp') diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp index 77b4dbf8c..469e1e7a6 100644 --- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp @@ -328,18 +328,20 @@ unsigned compareSubProperties(const QVariant & q1, const QVariant & q2, qdesigne { // Do not clobber new value in the comparison function in // case someone sets a QString on a PropertySheetStringValue. - if (q1.type() != q2.type()) + const int t1 = q1.metaType().id(); + const int t2 = q2.metaType().id(); + if (t1 != t2) return SubPropertyAll; - switch (q1.type()) { - case QVariant::Rect: + switch (t1) { + case QMetaType::QRect: return compareSubProperties(q1.toRect(), q2.toRect()); - case QVariant::Size: + case QMetaType::QSize: return compareSubProperties(q1.toSize(), q2.toSize()); - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: return compareSubProperties(qvariant_cast(q1), qvariant_cast(q2)); - case QVariant::Font: + case QMetaType::QFont: return compareSubProperties(qvariant_cast(q1), qvariant_cast(q2)); - case QVariant::Palette: + case QMetaType::QPalette: return compareSubProperties(qvariant_cast(q1), qvariant_cast(q2)); default: if (q1.userType() == qMetaTypeId()) @@ -527,14 +529,14 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant if (mask == SubPropertyAll) return PropertyHelper::Value(newValue, changed); - switch (oldValue.type()) { - case QVariant::Rect: + switch (oldValue.metaType().id()) { + case QMetaType::QRect: return PropertyHelper::Value(applyRectSubProperty(oldValue.toRect(), newValue.toRect(), mask), changed); - case QVariant::Size: + case QMetaType::QSize: return PropertyHelper::Value(applySizeSubProperty(oldValue.toSize(), newValue.toSize(), mask), changed); - case QVariant::SizePolicy: + case QMetaType::QSizePolicy: return PropertyHelper::Value(QVariant::fromValue(applySizePolicySubProperty(qvariant_cast(oldValue), qvariant_cast(newValue), mask)), changed); - case QVariant::Font: { + case QMetaType::QFont: { // Changed flag in case of font and palette depends on resolve mask only, not on the passed "changed" value. // The first case: the user changed bold subproperty and then pressed reset button for this subproperty (not for @@ -554,7 +556,7 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant QFont font = applyFontSubProperty(qvariant_cast(oldValue), qvariant_cast(newValue), mask); return PropertyHelper::Value(QVariant::fromValue(font), font.resolveMask()); } - case QVariant::Palette: { + case QMetaType::QPalette: { QPalette palette = applyPaletteSubProperty(qvariant_cast(oldValue), qvariant_cast(newValue), mask); return PropertyHelper::Value(QVariant::fromValue(palette), palette.resolveMask()); } @@ -887,7 +889,7 @@ QVariant PropertyHelper::findDefaultValue(QDesignerFormWindowInterface *fw) cons if (m_index < default_prop_values.size()) return default_prop_values.at(m_index); - if (m_oldValue.first.type() == QVariant::Color) + if (m_oldValue.first.metaType().id() == QMetaType::QColor) return QColor(); return m_oldValue.first; // Again, we just don't know @@ -935,7 +937,7 @@ PropertyListCommand::PropertyDescription::PropertyDescription(const QString &pro int index) : m_propertyName(propertyName), m_propertyGroup(propertySheet->propertyGroup(index)), - m_propertyType(propertySheet->property(index).type()), + m_propertyType(propertySheet->property(index).metaType().id()), m_specialProperty(getSpecialProperty(propertyName)) { } -- cgit v1.2.3