summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-28 09:31:42 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-28 13:05:59 +0100
commit8256ff13a8aab1aed192bb19a08c7126ac9028ae (patch)
tree1c32ae839a49861ac569794a792c17f230bad0f1 /src/designer/src/lib/shared/qdesigner_propertycommand.cpp
parent53113619ebad588859dac886c89356cd0ea2efba (diff)
Qt Designer: Port away from deprecated QVariant::Type
Change-Id: Ie0f7364454047ca7c9715f8d48814d71334a3cde Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_propertycommand.cpp')
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp32
1 files changed, 17 insertions, 15 deletions
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<QSizePolicy>(q1), qvariant_cast<QSizePolicy>(q2));
- case QVariant::Font:
+ case QMetaType::QFont:
return compareSubProperties(qvariant_cast<QFont>(q1), qvariant_cast<QFont>(q2));
- case QVariant::Palette:
+ case QMetaType::QPalette:
return compareSubProperties(qvariant_cast<QPalette>(q1), qvariant_cast<QPalette>(q2));
default:
if (q1.userType() == qMetaTypeId<qdesigner_internal::PropertySheetIconValue>())
@@ -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<QSizePolicy>(oldValue), qvariant_cast<QSizePolicy>(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<QFont>(oldValue), qvariant_cast<QFont>(newValue), mask);
return PropertyHelper::Value(QVariant::fromValue(font), font.resolveMask());
}
- case QVariant::Palette: {
+ case QMetaType::QPalette: {
QPalette palette = applyPaletteSubProperty(qvariant_cast<QPalette>(oldValue), qvariant_cast<QPalette>(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))
{
}