summaryrefslogtreecommitdiffstats
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
parent53113619ebad588859dac886c89356cd0ea2efba (diff)
Qt Designer: Port away from deprecated QVariant::Type
Change-Id: Ie0f7364454047ca7c9715f8d48814d71334a3cde Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/designer/src/components/formeditor/dpi_chooser.cpp4
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.cpp6
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp16
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp2
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.cpp11
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp179
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp4
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp88
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.h2
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp28
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp4
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.cpp2
-rw-r--r--src/designer/src/components/taskmenu/listwidgeteditor.cpp6
-rw-r--r--src/designer/src/components/taskmenu/tablewidgeteditor.cpp14
-rw-r--r--src/designer/src/components/taskmenu/treewidgeteditor.cpp14
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp4
-rw-r--r--src/designer/src/designer/mainwindow.cpp2
-rw-r--r--src/designer/src/lib/sdk/abstractintrospection.cpp4
-rw-r--r--src/designer/src/lib/sdk/abstractintrospection_p.h2
-rw-r--r--src/designer/src/lib/shared/newformwidget.cpp6
-rw-r--r--src/designer/src/lib/shared/qdesigner_introspection.cpp2
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp32
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand_p.h2
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp90
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog.cpp2
-rw-r--r--src/designer/src/lib/shared/qtresourceview.cpp2
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp2
-rw-r--r--src/designer/src/lib/uilib/properties.cpp68
-rw-r--r--src/designer/src/lib/uilib/resourcebuilder.cpp6
-rw-r--r--src/shared/qtpropertybrowser/qtvariantproperty.cpp310
30 files changed, 486 insertions, 428 deletions
diff --git a/src/designer/src/components/formeditor/dpi_chooser.cpp b/src/designer/src/components/formeditor/dpi_chooser.cpp
index 739d70832..8155016c0 100644
--- a/src/designer/src/components/formeditor/dpi_chooser.cpp
+++ b/src/designer/src/components/formeditor/dpi_chooser.cpp
@@ -145,7 +145,7 @@ void DPI_Chooser::setDPI(int dpiX, int dpiY)
int predefinedIndex = -1;
for (int i = 0; i < count; i++) {
const QVariant data = m_predefinedCombo->itemData(i);
- if (data.type() != QVariant::Invalid) {
+ if (data.metaType().id() != QMetaType::UnknownType) {
const struct DPI_Entry *entry = qvariant_cast<const struct DPI_Entry *>(data);
if (entry->dpiX == dpiX && entry->dpiY == dpiY) {
predefinedIndex = i;
@@ -178,7 +178,7 @@ void DPI_Chooser::syncSpinBoxes()
const QVariant data = m_predefinedCombo->itemData(predefIdx);
// Predefined mode in which spin boxes are disabled or user defined?
- const bool userSetting = data.type() == QVariant::Invalid;
+ const bool userSetting = data.metaType().id() == QMetaType::UnknownType;
m_dpiXSpinBox->setEnabled(userSetting);
m_dpiYSpinBox->setEnabled(userSetting);
diff --git a/src/designer/src/components/formeditor/previewactiongroup.cpp b/src/designer/src/components/formeditor/previewactiongroup.cpp
index a85fb22c0..ea388da33 100644
--- a/src/designer/src/components/formeditor/previewactiongroup.cpp
+++ b/src/designer/src/components/formeditor/previewactiongroup.cpp
@@ -116,11 +116,11 @@ void PreviewActionGroup::slotTriggered(QAction *a)
{
// Device or style according to data.
const QVariant data = a->data();
- switch (data.type()) {
- case QVariant::String:
+ switch (data.metaType().id()) {
+ case QMetaType::QString:
emit preview(data.toString(), -1);
break;
- case QVariant::Int:
+ case QMetaType::Int:
emit preview(QString(), data.toInt());
break;
default:
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index bcec066ee..970e6f352 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -668,7 +668,7 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
const DomPropertyList::const_iterator cend = domPropertyList.constEnd();
for (DomPropertyList::const_iterator it = domPropertyList.constBegin(); it != cend; ++it) {
const QVariant vprop = domPropertyToVariant(this, mainWidget->metaObject(), *it);
- if (vprop.type() != QVariant::Invalid)
+ if (vprop.metaType().id() != QMetaType::UnknownType)
designerFormData.insert((*it)->attributeName(), vprop);
}
}
@@ -992,25 +992,25 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
sheet->setProperty(index, v);
sheet->setChanged(index, true);
} else if (dynamicPropertiesAllowed) {
- QVariant defaultValue = QVariant(v.type());
+ QVariant defaultValue = QVariant(v.metaType());
bool isDefault = (v == defaultValue);
if (v.canConvert<PropertySheetIconValue>()) {
- defaultValue = QVariant(QVariant::Icon);
+ defaultValue = QVariant(QMetaType(QMetaType::QIcon));
isDefault = (qvariant_cast<PropertySheetIconValue>(v) == PropertySheetIconValue());
} else if (v.canConvert<PropertySheetPixmapValue>()) {
- defaultValue = QVariant(QVariant::Pixmap);
+ defaultValue = QVariant(QMetaType(QMetaType::QPixmap));
isDefault = (qvariant_cast<PropertySheetPixmapValue>(v) == PropertySheetPixmapValue());
} else if (v.canConvert<PropertySheetStringValue>()) {
- defaultValue = QVariant(QVariant::String);
+ defaultValue = QVariant(QMetaType(QMetaType::QString));
isDefault = (qvariant_cast<PropertySheetStringValue>(v) == PropertySheetStringValue());
} else if (v.canConvert<PropertySheetStringListValue>()) {
- defaultValue = QVariant(QVariant::StringList);
+ defaultValue = QVariant(QMetaType(QMetaType::QStringList));
isDefault = (qvariant_cast<PropertySheetStringListValue>(v) == PropertySheetStringListValue());
} else if (v.canConvert<PropertySheetKeySequenceValue>()) {
- defaultValue = QVariant(QVariant::KeySequence);
+ defaultValue = QVariant(QMetaType(QMetaType::QKeySequence));
isDefault = (qvariant_cast<PropertySheetKeySequenceValue>(v) == PropertySheetKeySequenceValue());
}
- if (defaultValue.type() != QVariant::UserType) {
+ if (defaultValue.metaType().id() != QMetaType::User) {
const int idx = dynamicSheet->addDynamicProperty(p->attributeName(), defaultValue);
if (idx != -1) {
sheet->setProperty(idx, v);
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel.cpp b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
index c539f8f3d..3f8c6a665 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -463,7 +463,7 @@ namespace qdesigner_internal {
const QVariant rc = QStandardItemModel::data(index, role);
// Return <noname> if the string is empty for the display role
// only (else, editing starts with <noname>).
- if (role == Qt::DisplayRole && rc.type() == QVariant::String) {
+ if (role == Qt::DisplayRole && rc.metaType().id() == QMetaType::QString) {
const QString s = rc.toString();
if (s.isEmpty()) {
static const QString noName = QCoreApplication::translate("ObjectInspectorModel", "<noname>");
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
index 41887cda2..aa94e17f3 100644
--- a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
@@ -159,7 +159,8 @@ void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtPr
m_brushPropertyToStyleSubProperty.insert(property, styleSubProperty);
m_brushStyleSubPropertyToProperty.insert(styleSubProperty, property);
// color
- QtVariantProperty *colorSubProperty = vm->addProperty(QVariant::Color, QCoreApplication::translate("BrushPropertyManager", "Color"));
+ QtVariantProperty *colorSubProperty =
+ vm->addProperty(QMetaType::QColor, QCoreApplication::translate("BrushPropertyManager", "Color"));
property->addSubProperty(colorSubProperty);
m_brushPropertyToColorSubProperty.insert(property, colorSubProperty);
m_brushColorSubPropertyToProperty.insert(colorSubProperty, property);
@@ -207,8 +208,8 @@ void BrushPropertyManager::slotPropertyDestroyed(QtProperty *property)
int BrushPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
{
- switch (value.type()) {
- case QVariant::Int: // Style subproperty?
+ switch (value.metaType().id()) {
+ case QMetaType::Int: // Style subproperty?
if (QtProperty *brushProperty = m_brushStyleSubPropertyToProperty.value(property, 0)) {
const QBrush oldValue = m_brushValues.value(brushProperty);
QBrush newBrush = oldValue;
@@ -220,7 +221,7 @@ int BrushPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty
return DesignerPropertyManager::Changed;
}
break;
- case QVariant::Color: // Color subproperty?
+ case QMetaType::QColor: // Color subproperty?
if (QtProperty *brushProperty = m_brushColorSubPropertyToProperty.value(property, 0)) {
const QBrush oldValue = m_brushValues.value(brushProperty);
QBrush newBrush = oldValue;
@@ -239,7 +240,7 @@ int BrushPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty
int BrushPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
{
- if (value.type() != QVariant::Brush)
+ if (value.metaType().id() != QMetaType::QBrush)
return DesignerPropertyManager::NoMatch;
const PropertyBrushMap::iterator brit = m_brushValues.find(property);
if (brit == m_brushValues.end())
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
index 48a59b458..7ec0eb561 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -104,28 +104,29 @@ void TranslatablePropertyManager<PropertySheetValue>::initialize(QtVariantProper
{
m_values.insert(property, value);
- QtVariantProperty *translatable = m->addProperty(QVariant::Bool, DesignerPropertyManager::tr("translatable"));
+ QtVariantProperty *translatable = m->addProperty(QMetaType::Bool, DesignerPropertyManager::tr("translatable"));
translatable->setValue(value.translatable());
m_valueToTranslatable.insert(property, translatable);
m_translatableToValue.insert(translatable, property);
property->addSubProperty(translatable);
if (!DesignerPropertyManager::useIdBasedTranslations()) {
- QtVariantProperty *disambiguation = m->addProperty(QVariant::String, DesignerPropertyManager::tr("disambiguation"));
+ QtVariantProperty *disambiguation =
+ m->addProperty(QMetaType::QString, DesignerPropertyManager::tr("disambiguation"));
disambiguation->setValue(value.disambiguation());
m_valueToDisambiguation.insert(property, disambiguation);
m_disambiguationToValue.insert(disambiguation, property);
property->addSubProperty(disambiguation);
}
- QtVariantProperty *comment = m->addProperty(QVariant::String, DesignerPropertyManager::tr("comment"));
+ QtVariantProperty *comment = m->addProperty(QMetaType::QString, DesignerPropertyManager::tr("comment"));
comment->setValue(value.comment());
m_valueToComment.insert(property, comment);
m_commentToValue.insert(comment, property);
property->addSubProperty(comment);
if (DesignerPropertyManager::useIdBasedTranslations()) {
- QtVariantProperty *id = m->addProperty(QVariant::String, DesignerPropertyManager::tr("id"));
+ QtVariantProperty *id = m->addProperty(QMetaType::QString, DesignerPropertyManager::tr("id"));
id->setValue(value.id());
m_valueToId.insert(property, id);
m_idToValue.insert(id, property);
@@ -1166,11 +1167,11 @@ QStringList DesignerPropertyManager::attributes(int propertyType) const
list.append(QLatin1String(defaultResourceAttributeC));
} else if (propertyType == designerIconTypeId()) {
list.append(QLatin1String(defaultResourceAttributeC));
- } else if (propertyType == designerStringTypeId() || propertyType == QVariant::String) {
+ } else if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
list.append(QLatin1String(validationModesAttributeC));
list.append(QLatin1String(fontAttributeC));
list.append(QLatin1String(themeAttributeC));
- } else if (propertyType == QVariant::Palette) {
+ } else if (propertyType == QMetaType::QPalette) {
list.append(QLatin1String(superPaletteAttributeC));
}
list.append(QLatin1String(resettableAttributeC));
@@ -1185,21 +1186,21 @@ int DesignerPropertyManager::attributeType(int propertyType, const QString &attr
if (propertyType == designerFlagTypeId() && attribute == QLatin1String(flagsAttributeC))
return designerFlagListTypeId();
if (propertyType == designerPixmapTypeId() && attribute == QLatin1String(defaultResourceAttributeC))
- return QVariant::Pixmap;
+ return QMetaType::QPixmap;
if (propertyType == designerIconTypeId() && attribute == QLatin1String(defaultResourceAttributeC))
- return QVariant::Icon;
+ return QMetaType::QIcon;
if (attribute == QLatin1String(resettableAttributeC))
- return QVariant::Bool;
- if (propertyType == designerStringTypeId() || propertyType == QVariant::String) {
+ return QMetaType::Bool;
+ if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
if (attribute == QLatin1String(validationModesAttributeC))
- return QVariant::Int;
+ return QMetaType::Int;
if (attribute == QLatin1String(fontAttributeC))
- return QVariant::Font;
+ return QMetaType::QFont;
if (attribute == QLatin1String(themeAttributeC))
- return QVariant::Bool;
+ return QMetaType::Bool;
}
- if (propertyType == QVariant::Palette && attribute == QLatin1String(superPaletteAttributeC))
- return QVariant::Palette;
+ if (propertyType == QMetaType::QPalette && attribute == QLatin1String(superPaletteAttributeC))
+ return QMetaType::QPalette;
return QtVariantPropertyManager::attributeType(propertyType, attribute);
}
@@ -1263,7 +1264,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
const QString &attribute, const QVariant &value)
{
if (attribute == QLatin1String(resettableAttributeC) && m_resetMap.contains(property)) {
- if (value.userType() != QVariant::Bool)
+ if (value.userType() != QMetaType::Bool)
return;
const bool val = value.toBool();
const PropertyBoolMap::iterator it = m_resetMap.find(property);
@@ -1296,7 +1297,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
for (const QPair<QString, uint> &pair : flags) {
const QString flagName = pair.first;
- QtProperty *prop = addProperty(QVariant::Bool);
+ QtProperty *prop = addProperty(QMetaType::Bool);
prop->setPropertyName(flagName);
property->addSubProperty(prop);
m_propertyToFlags[property].append(prop);
@@ -1317,7 +1318,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit propertyChanged(property);
emit QtVariantPropertyManager::valueChanged(property, data.val);
} else if (attribute == QLatin1String(validationModesAttributeC) && m_stringAttributes.contains(property)) {
- if (value.userType() != QVariant::Int)
+ if (value.userType() != QMetaType::Int)
return;
const PropertyIntMap::iterator it = m_stringAttributes.find(property);
@@ -1332,7 +1333,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(property, attribute, newValue);
} else if (attribute == QLatin1String(fontAttributeC) && m_stringFontAttributes.contains(property)) {
- if (value.userType() != QVariant::Font)
+ if (value.userType() != QMetaType::QFont)
return;
const PropertyFontMap::iterator it = m_stringFontAttributes.find(property);
@@ -1347,7 +1348,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(property, attribute, newValue);
} else if (attribute == QLatin1String(themeAttributeC) && m_stringThemeAttributes.contains(property)) {
- if (value.userType() != QVariant::Bool)
+ if (value.userType() != QMetaType::Bool)
return;
const PropertyBoolMap::iterator it = m_stringThemeAttributes.find(property);
@@ -1362,7 +1363,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(property, attribute, newValue);
} else if (attribute == QLatin1String(superPaletteAttributeC) && m_paletteValues.contains(property)) {
- if (value.userType() != QVariant::Palette)
+ if (value.userType() != QMetaType::QPalette)
return;
QPalette superPalette = qvariant_cast<QPalette>(value);
@@ -1387,7 +1388,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit propertyChanged(property);
emit QtVariantPropertyManager::valueChanged(property, data.val); // if resolve was done, this is also for consistency
} else if (attribute == QLatin1String(defaultResourceAttributeC) && m_defaultPixmaps.contains(property)) {
- if (value.userType() != QVariant::Pixmap)
+ if (value.userType() != QMetaType::QPixmap)
return;
QPixmap defaultPixmap = qvariant_cast<QPixmap>(value);
@@ -1404,7 +1405,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit propertyChanged(property);
} else if (attribute == QLatin1String(defaultResourceAttributeC) && m_defaultIcons.contains(property)) {
- if (value.userType() != QVariant::Icon)
+ if (value.userType() != QMetaType::QIcon)
return;
QIcon defaultIcon = qvariant_cast<QIcon>(value);
@@ -1481,14 +1482,14 @@ int DesignerPropertyManager::designerKeySequenceTypeId()
bool DesignerPropertyManager::isPropertyTypeSupported(int propertyType) const
{
switch (propertyType) {
- case QVariant::Palette:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
- case QVariant::Url:
- case QVariant::ByteArray:
- case QVariant::StringList:
- case QVariant::Brush:
+ case QMetaType::QPalette:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
+ case QMetaType::QUrl:
+ case QMetaType::QByteArray:
+ case QMetaType::QStringList:
+ case QMetaType::QBrush:
return true;
default:
break;
@@ -1574,20 +1575,22 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const
return QString::fromUtf8(m_byteArrayValues.value(const_cast<QtProperty *>(property)));
}
const int vType = QtVariantPropertyManager::valueType(property);
- if (vType == QVariant::String || vType == designerStringTypeId()) {
- const QString str = (QtVariantPropertyManager::valueType(property) == QVariant::String) ? value(property).toString() : qvariant_cast<PropertySheetStringValue>(value(property)).value();
+ if (vType == QMetaType::QString || vType == designerStringTypeId()) {
+ const QString str = (QtVariantPropertyManager::valueType(property) == QMetaType::QString)
+ ? value(property).toString() : qvariant_cast<PropertySheetStringValue>(value(property)).value();
const int validationMode = attributeValue(property, QLatin1String(validationModesAttributeC)).toInt();
return TextPropertyEditor::stringToEditorString(str, static_cast<TextPropertyValidationMode>(validationMode));
}
- if (vType == QVariant::StringList || vType == designerStringListTypeId()) {
+ if (vType == QMetaType::QStringList || vType == designerStringListTypeId()) {
QVariant v = value(property);
- const QStringList list = v.type() == QVariant::StringList ? v.toStringList() : qvariant_cast<PropertySheetStringListValue>(v).value();
+ const QStringList list = v.metaType().id() == QMetaType::QStringList
+ ? v.toStringList() : qvariant_cast<PropertySheetStringListValue>(v).value();
return list.join(QLatin1String("; "));
}
if (vType == designerKeySequenceTypeId()) {
return qvariant_cast<PropertySheetKeySequenceValue>(value(property)).value().toString(QKeySequence::NativeText);
}
- if (vType == QVariant::Bool) {
+ if (vType == QMetaType::Bool) {
return QString();
}
@@ -1695,22 +1698,22 @@ QVariant DesignerPropertyManager::value(const QtProperty *property) const
int DesignerPropertyManager::valueType(int propertyType) const
{
switch (propertyType) {
- case QVariant::Palette:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
- case QVariant::Url:
- case QVariant::ByteArray:
- case QVariant::StringList:
- case QVariant::Brush:
+ case QMetaType::QPalette:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
+ case QMetaType::QUrl:
+ case QMetaType::QByteArray:
+ case QMetaType::QStringList:
+ case QMetaType::QBrush:
return propertyType;
default:
break;
}
if (propertyType == designerFlagTypeId())
- return QVariant::UInt;
+ return QMetaType::UInt;
if (propertyType == designerAlignmentTypeId())
- return QVariant::UInt;
+ return QMetaType::UInt;
if (propertyType == designerPixmapTypeId())
return propertyType;
if (propertyType == designerIconTypeId())
@@ -1742,7 +1745,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
const PropertyFlagDataMap::iterator fit = m_flagValues.find(property);
if (fit != m_flagValues.end()) {
- if (value.type() != QVariant::UInt && !value.canConvert<uint>())
+ if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
const uint v = value.toUInt();
@@ -1794,7 +1797,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_alignValues.contains(property)) {
- if (value.type() != QVariant::UInt && !value.canConvert<uint>())
+ if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
const uint v = value.toUInt();
@@ -1820,7 +1823,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_paletteValues.contains(property)) {
- if (value.type() != QVariant::Palette && !value.canConvert<QPalette>())
+ if (value.metaType().id() != QMetaType::QPalette && !value.canConvert<QPalette>())
return;
QPalette p = qvariant_cast<QPalette>(value);
@@ -1915,7 +1918,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_uintValues.contains(property)) {
- if (value.type() != QVariant::UInt && !value.canConvert<uint>())
+ if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
const uint v = value.toUInt(nullptr);
@@ -1932,7 +1935,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_longLongValues.contains(property)) {
- if (value.type() != QVariant::LongLong && !value.canConvert<qlonglong>())
+ if (value.metaType().id() != QMetaType::LongLong && !value.canConvert<qlonglong>())
return;
const qlonglong v = value.toLongLong(nullptr);
@@ -1949,7 +1952,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_uLongLongValues.contains(property)) {
- if (value.type() != QVariant::ULongLong && !value.canConvert<qulonglong>())
+ if (value.metaType().id() != QMetaType::ULongLong && !value.canConvert<qulonglong>())
return;
qulonglong v = value.toULongLong(nullptr);
@@ -1966,7 +1969,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_urlValues.contains(property)) {
- if (value.type() != QVariant::Url && !value.canConvert<QUrl>())
+ if (value.metaType().id() != QMetaType::QUrl && !value.canConvert<QUrl>())
return;
const QUrl v = value.toUrl();
@@ -1983,7 +1986,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_byteArrayValues.contains(property)) {
- if (value.type() != QVariant::ByteArray && !value.canConvert<QByteArray>())
+ if (value.metaType().id() != QMetaType::QByteArray && !value.canConvert<QByteArray>())
return;
const QByteArray v = value.toByteArray();
@@ -2001,7 +2004,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
}
m_fontManager.setValue(this, property, value);
QtVariantPropertyManager::setValue(property, value);
- if (QtVariantPropertyManager::valueType(property) == QVariant::Bool)
+ if (QtVariantPropertyManager::valueType(property) == QMetaType::Bool)
property->setToolTip(QtVariantPropertyManager::valueText(property));
}
@@ -2012,30 +2015,30 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
const int type = propertyType(property);
m_fontManager.preInitializeProperty(property, type, m_resetMap);
switch (type) {
- case QVariant::Palette:
+ case QMetaType::QPalette:
m_paletteValues[property] = PaletteData();
break;
- case QVariant::String:
+ case QMetaType::QString:
m_stringAttributes[property] = ValidationSingleLine;
m_stringFontAttributes[property] = QApplication::font();
m_stringThemeAttributes[property] = false;
break;
- case QVariant::UInt:
+ case QMetaType::UInt:
m_uintValues[property] = 0;
break;
- case QVariant::LongLong:
+ case QMetaType::LongLong:
m_longLongValues[property] = 0;
break;
- case QVariant::ULongLong:
+ case QMetaType::ULongLong:
m_uLongLongValues[property] = 0;
break;
- case QVariant::Url:
+ case QMetaType::QUrl:
m_urlValues[property] = QUrl();
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
m_byteArrayValues[property] = QByteArray();
break;
- case QVariant::Brush:
+ case QMetaType::QBrush:
m_brushManager.initializeProperty(this, property, enumTypeId());
break;
default:
@@ -2070,7 +2073,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
m_iconValues[property] = PropertySheetIconValue();
m_defaultIcons[property] = QIcon();
- QtVariantProperty *themeProp = addProperty(QVariant::String, tr("Theme"));
+ QtVariantProperty *themeProp = addProperty(QMetaType::QString, tr("Theme"));
themeProp->setAttribute(QLatin1String(themeAttributeC), true);
m_iconSubPropertyToProperty[themeProp] = property;
m_propertyToTheme[property] = themeProp;
@@ -2099,7 +2102,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
QtVariantPropertyManager::initializeProperty(property);
m_fontManager.postInitializeProperty(this, property, type, DesignerPropertyManager::enumTypeId());
- if (type == QVariant::Double)
+ if (type == QMetaType::Double)
setAttribute(property, QStringLiteral("decimals"), 6);
}
@@ -2287,7 +2290,7 @@ void DesignerEditorFactory::slotAttributeChanged(QtProperty *property, const QSt
if (type == DesignerPropertyManager::designerPixmapTypeId() && attribute == QLatin1String(defaultResourceAttributeC)) {
const QPixmap pixmap = qvariant_cast<QPixmap>(value);
applyToEditors(m_pixmapPropertyToEditors.value(property), &PixmapEditor::setDefaultPixmap, pixmap);
- } else if (type == DesignerPropertyManager::designerStringTypeId() || type == QVariant::String) {
+ } else if (type == DesignerPropertyManager::designerStringTypeId() || type == QMetaType::QString) {
if (attribute == QLatin1String(validationModesAttributeC)) {
const TextPropertyValidationMode validationMode = static_cast<TextPropertyValidationMode>(value.toInt());
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setTextPropertyValidationMode, validationMode);
@@ -2300,7 +2303,7 @@ void DesignerEditorFactory::slotAttributeChanged(QtProperty *property, const QSt
const bool themeEnabled = value.toBool();
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setIconThemeModeEnabled, themeEnabled);
}
- } else if (type == QVariant::Palette && attribute == QLatin1String(superPaletteAttributeC)) {
+ } else if (type == QMetaType::QPalette && attribute == QLatin1String(superPaletteAttributeC)) {
const QPalette palette = qvariant_cast<QPalette>(value);
applyToEditors(m_palettePropertyToEditors.value(property), &PaletteEditorButton::setSuperPalette, palette);
}
@@ -2330,28 +2333,28 @@ void DesignerEditorFactory::slotValueChanged(QtProperty *property, const QVarian
QtVariantPropertyManager *manager = propertyManager(property);
const int type = manager->propertyType(property);
switch (type) {
- case QVariant::String:
+ case QMetaType::QString:
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setText, value.toString());
break;
- case QVariant::Palette:
+ case QMetaType::QPalette:
applyToEditors(m_palettePropertyToEditors.value(property), &PaletteEditorButton::setPalette, qvariant_cast<QPalette>(value));
break;
- case QVariant::UInt:
+ case QMetaType::UInt:
applyToEditors(m_uintPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toUInt()));
break;
- case QVariant::LongLong:
+ case QMetaType::LongLong:
applyToEditors(m_longLongPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toLongLong()));
break;
- case QVariant::ULongLong:
+ case QMetaType::ULongLong:
applyToEditors(m_uLongLongPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toULongLong()));
break;
- case QVariant::Url:
+ case QMetaType::QUrl:
applyToEditors(m_urlPropertyToEditors.value(property), &TextEditor::setText, value.toUrl().toString());
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
applyToEditors(m_byteArrayPropertyToEditors.value(property), &TextEditor::setText, QString::fromUtf8(value.toByteArray()));
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
applyToEditors(m_stringListPropertyToEditors.value(property), &StringListEditorButton::setStringList, value.toStringList());
break;
default:
@@ -2388,18 +2391,18 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
QWidget *editor = nullptr;
const int type = manager->propertyType(property);
switch (type) {
- case QVariant::Bool: {
+ case QMetaType::Bool: {
editor = QtVariantEditorFactory::createEditor(manager, property, parent);
QtBoolEdit *boolEdit = qobject_cast<QtBoolEdit *>(editor);
if (boolEdit)
boolEdit->setTextVisible(false);
}
break;
- case QVariant::String: {
+ case QMetaType::QString: {
const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt());
TextEditor *ed = createTextEditor(parent, tvm, manager->value(property).toString());
const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC));
- if (richTextDefaultFont.type() == QVariant::Font)
+ if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
const bool themeEnabled = manager->attributeValue(property, QLatin1String(themeAttributeC)).toBool();
ed->setIconThemeModeEnabled(themeEnabled);
@@ -2410,7 +2413,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::Palette: {
+ case QMetaType::QPalette: {
PaletteEditorButton *ed = new PaletteEditorButton(m_core, qvariant_cast<QPalette>(manager->value(property)), parent);
ed->setSuperPalette(qvariant_cast<QPalette>(manager->attributeValue(property, QLatin1String(superPaletteAttributeC))));
m_palettePropertyToEditors[property].append(ed);
@@ -2420,7 +2423,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::UInt: {
+ case QMetaType::UInt: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QULongLongValidator(0, UINT_MAX, ed));
ed->setText(QString::number(manager->value(property).toUInt()));
@@ -2431,7 +2434,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::LongLong: {
+ case QMetaType::LongLong: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QLongLongValidator(ed));
ed->setText(QString::number(manager->value(property).toLongLong()));
@@ -2442,7 +2445,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::ULongLong: {
+ case QMetaType::ULongLong: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QULongLongValidator(ed));
ed->setText(QString::number(manager->value(property).toULongLong()));
@@ -2453,7 +2456,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::Url: {
+ case QMetaType::QUrl: {
TextEditor *ed = createTextEditor(parent, ValidationURL, manager->value(property).toUrl().toString());
ed->setUpdateMode(TextPropertyEditor::UpdateOnFinished);
m_urlPropertyToEditors[property].append(ed);
@@ -2463,7 +2466,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::ByteArray: {
+ case QMetaType::QByteArray: {
TextEditor *ed = createTextEditor(parent, ValidationMultiLine, QString::fromUtf8(manager->value(property).toByteArray()));
m_byteArrayPropertyToEditors[property].append(ed);
m_editorToByteArrayProperty[ed] = property;
@@ -2508,17 +2511,17 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt());
TextEditor *ed = createTextEditor(parent, tvm, qvariant_cast<PropertySheetStringValue>(manager->value(property)).value());
const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC));
- if (richTextDefaultFont.type() == QVariant::Font)
+ if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
m_stringPropertyToEditors[property].append(ed);
m_editorToStringProperty[ed] = property;
connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed);
connect(ed, &TextEditor::textChanged, this, &DesignerEditorFactory::slotStringTextChanged);
editor = ed;
- } else if (type == DesignerPropertyManager::designerStringListTypeId() || type == QVariant::StringList) {
+ } else if (type == DesignerPropertyManager::designerStringListTypeId() || type == QMetaType::QStringList) {
const QVariant variantValue = manager->value(property);
- const QStringList value = type == QVariant::StringList ? variantValue.toStringList() :
- qvariant_cast<PropertySheetStringListValue>(variantValue).value();
+ const QStringList value = type == QMetaType::QStringList
+ ? variantValue.toStringList() : qvariant_cast<PropertySheetStringListValue>(variantValue).value();
StringListEditorButton *ed = new StringListEditorButton(value, parent);
m_stringListPropertyToEditors[property].append(ed);
m_editorToStringListProperty.insert(ed, property);
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
index b624de147..4974e7975 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -79,7 +79,7 @@ namespace qdesigner_internal {
resetMap[property] = true;
}
- if (type == QVariant::Font)
+ if (type == QMetaType::QFont)
m_createdFontProperty = property;
}
@@ -103,7 +103,7 @@ namespace qdesigner_internal {
int type,
int enumTypeId)
{
- if (type != QVariant::Font)
+ if (type != QMetaType::QFont)
return;
// This will cause a recursion
diff --git a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
index 0a0046c9c..91d554c8b 100644
--- a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
+++ b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
@@ -48,34 +48,62 @@ NewDynamicPropertyDialog::NewDynamicPropertyDialog(QDesignerDialogGuiInterface *
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- m_ui->m_comboBox->addItem(QStringLiteral("String"), QVariant(QVariant::String));
- m_ui->m_comboBox->addItem(QStringLiteral("StringList"), QVariant(QVariant::StringList));
- m_ui->m_comboBox->addItem(QStringLiteral("Char"), QVariant(QVariant::Char));
- m_ui->m_comboBox->addItem(QStringLiteral("ByteArray"), QVariant(QVariant::ByteArray));
- m_ui->m_comboBox->addItem(QStringLiteral("Url"), QVariant(QVariant::Url));
- m_ui->m_comboBox->addItem(QStringLiteral("Bool"), QVariant(QVariant::Bool));
- m_ui->m_comboBox->addItem(QStringLiteral("Int"), QVariant(QVariant::Int));
- m_ui->m_comboBox->addItem(QStringLiteral("UInt"), QVariant(QVariant::UInt));
- m_ui->m_comboBox->addItem(QStringLiteral("LongLong"), QVariant(QVariant::LongLong));
- m_ui->m_comboBox->addItem(QStringLiteral("ULongLong"), QVariant(QVariant::ULongLong));
- m_ui->m_comboBox->addItem(QStringLiteral("Double"), QVariant(QVariant::Double));
- m_ui->m_comboBox->addItem(QStringLiteral("Size"), QVariant(QVariant::Size));
- m_ui->m_comboBox->addItem(QStringLiteral("SizeF"), QVariant(QVariant::SizeF));
- m_ui->m_comboBox->addItem(QStringLiteral("Point"), QVariant(QVariant::Point));
- m_ui->m_comboBox->addItem(QStringLiteral("PointF"), QVariant(QVariant::PointF));
- m_ui->m_comboBox->addItem(QStringLiteral("Rect"), QVariant(QVariant::Rect));
- m_ui->m_comboBox->addItem(QStringLiteral("RectF"), QVariant(QVariant::RectF));
- m_ui->m_comboBox->addItem(QStringLiteral("Date"), QVariant(QVariant::Date));
- m_ui->m_comboBox->addItem(QStringLiteral("Time"), QVariant(QVariant::Time));
- m_ui->m_comboBox->addItem(QStringLiteral("DateTime"), QVariant(QVariant::DateTime));
- m_ui->m_comboBox->addItem(QStringLiteral("Font"), QVariant(QVariant::Font));
- m_ui->m_comboBox->addItem(QStringLiteral("Palette"), QVariant(QVariant::Palette));
- m_ui->m_comboBox->addItem(QStringLiteral("Color"), QVariant(QVariant::Color));
- m_ui->m_comboBox->addItem(QStringLiteral("Pixmap"), QVariant(QVariant::Pixmap));
- m_ui->m_comboBox->addItem(QStringLiteral("Icon"), QVariant(QVariant::Icon));
- m_ui->m_comboBox->addItem(QStringLiteral("Cursor"), QVariant(QVariant::Cursor));
- m_ui->m_comboBox->addItem(QStringLiteral("SizePolicy"), QVariant(QVariant::SizePolicy));
- m_ui->m_comboBox->addItem(QStringLiteral("KeySequence"), QVariant(QVariant::KeySequence));
+ m_ui->m_comboBox->addItem(QStringLiteral("String"),
+ QVariant(QMetaType(QMetaType::QString)));
+ m_ui->m_comboBox->addItem(QStringLiteral("StringList"),
+ QVariant(QMetaType(QMetaType::QStringList)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Char"),
+ QVariant(QMetaType(QMetaType::QChar)));
+ m_ui->m_comboBox->addItem(QStringLiteral("ByteArray"),
+ QVariant(QMetaType(QMetaType::QByteArray)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Url"),
+ QVariant(QMetaType(QMetaType::QUrl)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Bool"),
+ QVariant(QMetaType(QMetaType::Bool)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Int"),
+ QVariant(QMetaType(QMetaType::Int)));
+ m_ui->m_comboBox->addItem(QStringLiteral("UInt"),
+ QVariant(QMetaType(QMetaType::UInt)));
+ m_ui->m_comboBox->addItem(QStringLiteral("LongLong"),
+ QVariant(QMetaType(QMetaType::LongLong)));
+ m_ui->m_comboBox->addItem(QStringLiteral("ULongLong"),
+ QVariant(QMetaType(QMetaType::ULongLong)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Double"),
+ QVariant(QMetaType(QMetaType::Double)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Size"),
+ QVariant(QMetaType(QMetaType::QSize)));
+ m_ui->m_comboBox->addItem(QStringLiteral("SizeF"),
+ QVariant(QMetaType(QMetaType::QSizeF)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Point"),
+ QVariant(QMetaType(QMetaType::QPoint)));
+ m_ui->m_comboBox->addItem(QStringLiteral("PointF"),
+ QVariant(QMetaType(QMetaType::QPointF)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Rect"),
+ QVariant(QMetaType(QMetaType::QRect)));
+ m_ui->m_comboBox->addItem(QStringLiteral("RectF"),
+ QVariant(QMetaType(QMetaType::QRectF)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Date"),
+ QVariant(QMetaType(QMetaType::QDate)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Time"),
+ QVariant(QMetaType(QMetaType::QTime)));
+ m_ui->m_comboBox->addItem(QStringLiteral("DateTime"),
+ QVariant(QMetaType(QMetaType::QDateTime)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Font"),
+ QVariant(QMetaType(QMetaType::QFont)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Palette"),
+ QVariant(QMetaType(QMetaType::QPalette)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Color"),
+ QVariant(QMetaType(QMetaType::QColor)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Pixmap"),
+ QVariant(QMetaType(QMetaType::QPixmap)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Icon"),
+ QVariant(QMetaType(QMetaType::QIcon)));
+ m_ui->m_comboBox->addItem(QStringLiteral("Cursor"),
+ QVariant(QMetaType(QMetaType::QCursor)));
+ m_ui->m_comboBox->addItem(QStringLiteral("SizePolicy"),
+ QVariant(QMetaType(QMetaType::QSizePolicy)));
+ m_ui->m_comboBox->addItem(QStringLiteral("KeySequence"),
+ QVariant(QMetaType(QMetaType::QKeySequence)));
m_ui->m_comboBox->setCurrentIndex(0); // String
setOkButtonEnabled(false);
@@ -96,9 +124,9 @@ void NewDynamicPropertyDialog::setReservedNames(const QStringList &names)
m_reservedNames = names;
}
-void NewDynamicPropertyDialog::setPropertyType(QVariant::Type t)
+void NewDynamicPropertyDialog::setPropertyType(int t)
{
- const int index = m_ui->m_comboBox->findData(QVariant(t));
+ const int index = m_ui->m_comboBox->findData(QVariant(QMetaType(t)));
if (index != -1)
m_ui->m_comboBox->setCurrentIndex(index);
}
diff --git a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h
index 17daee4c3..0c3e24570 100644
--- a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h
+++ b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h
@@ -64,7 +64,7 @@ public:
~NewDynamicPropertyDialog();
void setReservedNames(const QStringList &names);
- void setPropertyType(QVariant::Type t);
+ void setPropertyType(int t);
QString propertyName() const;
QVariant propertyValue() const;
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp
index f42fba6b3..3d0647190 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -256,14 +256,14 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
m_addDynamicAction->setMenu(addDynamicActionMenu);
m_addDynamicAction->setEnabled(false);
QAction *addDynamicAction = addDynamicActionGroup->addAction(tr("String..."));
- addDynamicAction->setData(static_cast<int>(QVariant::String));
+ addDynamicAction->setData(static_cast<int>(QMetaType::QString));
addDynamicActionMenu->addAction(addDynamicAction);
addDynamicAction = addDynamicActionGroup->addAction(tr("Bool..."));
- addDynamicAction->setData(static_cast<int>(QVariant::Bool));
+ addDynamicAction->setData(static_cast<int>(QMetaType::Bool));
addDynamicActionMenu->addAction(addDynamicAction);
addDynamicActionMenu->addSeparator();
addDynamicAction = addDynamicActionGroup->addAction(tr("Other..."));
- addDynamicAction->setData(static_cast<int>(QVariant::Invalid));
+ addDynamicAction->setData(static_cast<int>(QMetaType::UnknownType));
addDynamicActionMenu->addAction(addDynamicAction);
// remove
m_removeDynamicAction->setEnabled(false);
@@ -695,9 +695,9 @@ void PropertyEditor::slotAddDynamicProperty(QAction *action)
QString newName;
QVariant newValue;
{ // Make sure the dialog is closed before the signal is emitted.
- const QVariant::Type type = static_cast<QVariant::Type>(action->data().toInt());
+ const int type = action->data().toInt();
NewDynamicPropertyDialog dlg(core()->dialogGui(), m_currentBrowser);
- if (type != QVariant::Invalid)
+ if (type != QMetaType::UnknownType)
dlg.setPropertyType(type);
QStringList reservedNames;
@@ -815,7 +815,7 @@ void PropertyEditor::updateBrowserValue(QtVariantProperty *property, const QVari
}
// Rich text string property with comment: Store/Update the font the rich text editor dialog starts out with
- if (type == QVariant::String && !property->subProperties().isEmpty()) {
+ if (type == QMetaType::QString && !property->subProperties().isEmpty()) {
const int fontIndex = m_propertySheet->indexOf(m_strings.m_fontProperty);
if (fontIndex != -1)
property->setAttribute(m_strings.m_fontAttribute, m_propertySheet->property(fontIndex));
@@ -866,8 +866,8 @@ QString PropertyEditor::realClassName(QObject *object) const
static const char *typeName(int type)
{
if (type == qMetaTypeId<PropertySheetStringValue>())
- type = QVariant::String;
- if (type < int(QVariant::UserType))
+ type = QMetaType::QString;
+ if (type < int(QMetaType::User))
return QMetaType(type).name();
if (type == qMetaTypeId<PropertySheetIconValue>())
return "QIcon";
@@ -879,9 +879,9 @@ static const char *typeName(int type)
return "QFlags";
if (type == qMetaTypeId<PropertySheetEnumValue>())
return "enum";
- if (type == QVariant::Invalid)
+ if (type == QMetaType::UnknownType)
return "invalid";
- if (type == QVariant::UserType)
+ if (type == QMetaType::User)
return "user type";
return nullptr;
}
@@ -1041,16 +1041,16 @@ void PropertyEditor::setObject(QObject *object)
if (!descriptionToolTip.isEmpty())
property->setDescriptionToolTip(descriptionToolTip);
switch (type) {
- case QVariant::Palette:
+ case QMetaType::QPalette:
setupPaletteProperty(property);
break;
- case QVariant::KeySequence:
+ case QMetaType::QKeySequence:
//addCommentProperty(property, propertyName);
break;
default:
break;
}
- if (type == QVariant::String || type == qMetaTypeId<PropertySheetStringValue>())
+ if (type == QMetaType::QString || type == qMetaTypeId<PropertySheetStringValue>())
setupStringProperty(property, isMainContainer);
property->setAttribute(m_strings.m_resettableAttribute, m_propertySheet->hasReset(i));
@@ -1108,7 +1108,7 @@ void PropertyEditor::setObject(QObject *object)
updateBrowserValue(property, value);
property->setModified(m_propertySheet->isChanged(i));
- if (propertyName == QStringLiteral("geometry") && type == QVariant::Rect) {
+ if (propertyName == QStringLiteral("geometry") && type == QMetaType::QRect) {
const auto &subProperties = property->subProperties();
for (QtProperty *subProperty : subProperties) {
const QString subPropertyName = subProperty->propertyName();
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index fd6a90eb2..5570c141c 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -308,7 +308,7 @@ bool ConnectionModel::setData(const QModelIndex &index, const QVariant &data, in
{
if (!index.isValid() || !m_editor)
return false;
- if (data.type() != QVariant::String)
+ if (data.metaType().id() != QMetaType::QString)
return false;
SignalSlotConnection *con = static_cast<SignalSlotConnection*>(m_editor->connection(index.row()));
@@ -592,7 +592,7 @@ ConnectionDelegate::ConnectionDelegate(QWidget *parent)
factory = new QItemEditorFactory;
QItemEditorCreatorBase *creator
= new QItemEditorCreator<InlineEditor>("text");
- factory->registerEditor(QVariant::String, creator);
+ factory->registerEditor(QMetaType::QString, creator);
}
setItemEditorFactory(factory);
diff --git a/src/designer/src/components/taskmenu/itemlisteditor.cpp b/src/designer/src/components/taskmenu/itemlisteditor.cpp
index ffa793c17..7d8514bd3 100644
--- a/src/designer/src/components/taskmenu/itemlisteditor.cpp
+++ b/src/designer/src/components/taskmenu/itemlisteditor.cpp
@@ -412,7 +412,7 @@ void ItemListEditor::setItemData(int role, const QVariant &v)
|| role == Qt::FontRole)
reLayout = true;
QVariant newValue = v;
- if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
+ if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.listWidget->font();
QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
newValue = QVariant::fromValue(newFont);
diff --git a/src/designer/src/components/taskmenu/listwidgeteditor.cpp b/src/designer/src/components/taskmenu/listwidgeteditor.cpp
index 098dac2cd..668978c0d 100644
--- a/src/designer/src/components/taskmenu/listwidgeteditor.cpp
+++ b/src/designer/src/components/taskmenu/listwidgeteditor.cpp
@@ -74,10 +74,10 @@ static AbstractItemEditor::PropertyDefinition listBoxPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
{ Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QBrush, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" },
{ Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" },
{ 0, 0, nullptr, nullptr }
diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp
index b5f41626c..5c37106c9 100644
--- a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp
+++ b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp
@@ -108,10 +108,10 @@ static AbstractItemEditor::PropertyDefinition tableHeaderPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
// { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Color, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QColor, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ 0, 0, nullptr, nullptr }
};
@@ -121,10 +121,10 @@ static AbstractItemEditor::PropertyDefinition tableItemPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
// { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QBrush, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" },
{ Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" },
{ 0, 0, nullptr, nullptr }
@@ -167,7 +167,7 @@ void TableWidgetEditor::setItemData(int role, const QVariant &v)
ui.tableWidget->setItem(ui.tableWidget->currentRow(), ui.tableWidget->currentColumn(), item);
}
QVariant newValue = v;
- if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
+ if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.tableWidget->font();
QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
newValue = QVariant::fromValue(newFont);
diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.cpp b/src/designer/src/components/taskmenu/treewidgeteditor.cpp
index 5e77939e5..a7117beb5 100644
--- a/src/designer/src/components/taskmenu/treewidgeteditor.cpp
+++ b/src/designer/src/components/taskmenu/treewidgeteditor.cpp
@@ -108,10 +108,10 @@ static AbstractItemEditor::PropertyDefinition treeHeaderPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
{ Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Color, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QColor, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ 0, 0, nullptr, nullptr }
};
@@ -121,10 +121,10 @@ static AbstractItemEditor::PropertyDefinition treeItemColumnPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
{ Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QBrush, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" },
{ 0, 0, nullptr, nullptr }
};
@@ -181,7 +181,7 @@ void TreeWidgetEditor::setItemData(int role, const QVariant &v)
const int col = (role == ItemFlagsShadowRole) ? 0 : ui.treeWidget->currentColumn();
QVariant newValue = v;
BoolBlocker block(m_updatingBrowser);
- if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
+ if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.treeWidget->font();
QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
newValue = QVariant::fromValue(newFont);
diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
index 9f44c5d00..2f5b7f536 100644
--- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
@@ -269,8 +269,10 @@ QVariant WidgetBoxCategoryModel::data(const QModelIndex &index, int role) const
bool WidgetBoxCategoryModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
const int row = index.row();
- if (role != Qt::EditRole || row < 0 || row >= m_items.size() || value.type() != QVariant::String)
+ if (role != Qt::EditRole || row < 0 || row >= m_items.size()
+ || value.metaType().id() != QMetaType::QString) {
return false;
+ }
// Set name and adapt Xml
WidgetBoxCategoryEntry &item = m_items[row];
const QString newName = value.toString();
diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp
index a11f148a4..317deec8c 100644
--- a/src/designer/src/designer/mainwindow.cpp
+++ b/src/designer/src/designer/mainwindow.cpp
@@ -233,7 +233,7 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
// Filter out the device profile preview actions which have int data().
ActionList previewActions = actions->styleActions()->actions();
ActionList::iterator it = previewActions.begin();
- for ( ; (*it)->isSeparator() || (*it)->data().type() == QVariant::Int; ++it) ;
+ for ( ; (*it)->isSeparator() || (*it)->data().metaType().id() == QMetaType::Int; ++it) ;
previewActions.erase(previewActions.begin(), it);
addActionsToToolBarManager(previewActions, tr("Style"), m_manager);
diff --git a/src/designer/src/lib/sdk/abstractintrospection.cpp b/src/designer/src/lib/sdk/abstractintrospection.cpp
index 405796cdc..14bc2a5f2 100644
--- a/src/designer/src/lib/sdk/abstractintrospection.cpp
+++ b/src/designer/src/lib/sdk/abstractintrospection.cpp
@@ -203,9 +203,11 @@ QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface() = default;
*/
/*!
- \fn QVariant::Type QDesignerMetaPropertyInterface::type() const
+ \fn int QDesignerMetaPropertyInterface::type() const
Returns the type of the property.
+
+ \sa QMetaType::Type
*/
/*!
diff --git a/src/designer/src/lib/sdk/abstractintrospection_p.h b/src/designer/src/lib/sdk/abstractintrospection_p.h
index 985bba830..fedf5538c 100644
--- a/src/designer/src/lib/sdk/abstractintrospection_p.h
+++ b/src/designer/src/lib/sdk/abstractintrospection_p.h
@@ -86,7 +86,7 @@ public:
virtual AccessFlags accessFlags() const = 0;
virtual Attributes attributes() const = 0;
- virtual QVariant::Type type() const = 0;
+ virtual int type() const = 0;
virtual QString name() const = 0;
virtual QString typeName() const = 0;
virtual int userType() const = 0;
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp
index bef697266..e049a0660 100644
--- a/src/designer/src/lib/shared/newformwidget.cpp
+++ b/src/designer/src/lib/shared/newformwidget.cpp
@@ -259,11 +259,11 @@ QPixmap NewFormWidget::formPreviewPixmap(const QTreeWidgetItem *item)
// file or string?
const QVariant fileName = item->data(0, TemplateNameRole);
QPixmap rc;
- if (fileName.type() == QVariant::String) {
+ if (fileName.metaType().id() == QMetaType::QString) {
rc = formPreviewPixmap(fileName.toString());
} else {
const QVariant classNameV = item->data(0, ClassNameRole);
- Q_ASSERT(classNameV.type() == QVariant::String);
+ Q_ASSERT(classNameV.metaType().id() == QMetaType::QString);
const QString className = classNameV.toString();
QByteArray data = qdesigner_internal::WidgetDataBase::formTemplate(m_core, className, formName(className)).toUtf8();
QBuffer buffer(&data);
@@ -492,7 +492,7 @@ QString NewFormWidget::itemToTemplate(const QTreeWidgetItem *item, QString *erro
const QSize size = templateSize();
// file name or string contents?
const QVariant templateFileName = item->data(0, TemplateNameRole);
- if (templateFileName.type() == QVariant::String) {
+ if (templateFileName.metaType().id() == QMetaType::QString) {
const QString fileName = templateFileName.toString();
// No fixed size: just open.
if (size.isNull())
diff --git a/src/designer/src/lib/shared/qdesigner_introspection.cpp b/src/designer/src/lib/shared/qdesigner_introspection.cpp
index cdf896923..89dc6350e 100644
--- a/src/designer/src/lib/shared/qdesigner_introspection.cpp
+++ b/src/designer/src/lib/shared/qdesigner_introspection.cpp
@@ -101,7 +101,7 @@ namespace {
AccessFlags accessFlags() const override { return m_access; }
Attributes attributes() const override;
- QVariant::Type type() const override { return m_property.type(); }
+ int type() const override { return m_property.metaType().id(); }
QString name() const override { return m_name; }
QString typeName() const override { return m_typeName; }
int userType() const override { return m_property.userType(); }
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))
{
}
diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
index 1cc528a19..7afd7b55a 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
@@ -187,7 +187,7 @@ protected:
QString m_propertyName;
QString m_propertyGroup;
- QVariant::Type m_propertyType = QVariant::Invalid;
+ int m_propertyType = QMetaType::UnknownType;
SpecialProperty m_specialProperty = SP_None;
};
const PropertyDescription &propertyDescription() const { return m_propertyDescription; }
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 2582a3a14..eeaf48fdf 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -191,7 +191,7 @@ public:
bool isReloadableProperty(int index) const;
bool isResourceProperty(int index) const;
- void addResourceProperty(int index, QVariant::Type type);
+ void addResourceProperty(int index, int type);
QVariant resourceProperty(int index) const;
void setResourceProperty(int index, const QVariant &value);
QVariant emptyResourceProperty(int index) const; // of type PropertySheetPixmapValue / PropertySheetIconValue
@@ -270,7 +270,7 @@ bool QDesignerPropertySheetPrivate::isReloadableProperty(int index) const
return isResourceProperty(index)
|| propertyType(index) == QDesignerPropertySheet::PropertyStyleSheet
|| propertyType(index) == QDesignerPropertySheet::PropertyText
- || q->property(index).type() == QVariant::Url;
+ || q->property(index).metaType().id() == QMetaType::QUrl;
}
/*
@@ -285,11 +285,11 @@ bool QDesignerPropertySheetPrivate::isResourceProperty(int index) const
return m_resourceProperties.contains(index);
}
-void QDesignerPropertySheetPrivate::addResourceProperty(int index, QVariant::Type type)
+void QDesignerPropertySheetPrivate::addResourceProperty(int index, int type)
{
- if (type == QVariant::Pixmap)
+ if (type == QMetaType::QPixmap)
m_resourceProperties.insert(index, QVariant::fromValue(qdesigner_internal::PropertySheetPixmapValue()));
- else if (type == QVariant::Icon)
+ else if (type == QMetaType::QIcon)
m_resourceProperties.insert(index, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
}
@@ -598,7 +598,7 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
for (int index=0; index<count(); ++index) {
const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
const QString name = p->name();
- if (p->type() == QVariant::KeySequence) {
+ if (p->type() == QMetaType::QKeySequence) {
createFakeProperty(name);
} else {
setVisible(index, false); // use the default for `real' properties
@@ -614,22 +614,22 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
info.group = pgroup;
info.propertyType = propertyTypeFromName(name);
- const QVariant::Type type = p->type();
+ const int type = p->type();
switch (type) {
- case QVariant::Cursor:
- case QVariant::Icon:
- case QVariant::Pixmap:
+ case QMetaType::QCursor:
+ case QMetaType::QIcon:
+ case QMetaType::QPixmap:
info.defaultValue = p->read(d->m_object);
- if (type == QVariant::Icon || type == QVariant::Pixmap)
+ if (type == QMetaType::QIcon || type == QMetaType::QPixmap)
d->addResourceProperty(index, type);
break;
- case QVariant::String:
+ case QMetaType::QString:
d->addStringProperty(index);
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
d->addStringListProperty(index);
break;
- case QVariant::KeySequence:
+ case QMetaType::QKeySequence:
d->addKeySequenceProperty(index);
break;
default:
@@ -748,18 +748,25 @@ int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QV
return -1;
QVariant v = value;
- if (value.type() == QVariant::Icon)
+ switch (value.metaType().id()) {
+ case QMetaType::QIcon:
v = QVariant::fromValue(qdesigner_internal::PropertySheetIconValue());
- else if (value.type() == QVariant::Pixmap)
+ break;
+ case QMetaType::QPixmap:
v = QVariant::fromValue(qdesigner_internal::PropertySheetPixmapValue());
- else if (value.type() == QVariant::String)
+ break;
+ case QMetaType::QString:
v = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue(value.toString()));
- else if (value.type() == QVariant::StringList)
+ break;
+ case QMetaType::QStringList:
v = QVariant::fromValue(qdesigner_internal::PropertySheetStringListValue(value.toStringList()));
- else if (value.type() == QVariant::KeySequence) {
+ break;
+ case QMetaType::QKeySequence: {
const QKeySequence keySequence = qvariant_cast<QKeySequence>(value);
v = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
}
+ break;
+ }
if (d->m_addIndex.contains(propName)) {
const int idx = d->m_addIndex.value(propName);
@@ -771,12 +778,18 @@ int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QV
Info &info = d->ensureInfo(index);
info.defaultValue = value;
info.kind = QDesignerPropertySheetPrivate::DynamicProperty;
- if (value.type() == QVariant::Icon || value.type() == QVariant::Pixmap)
- d->addResourceProperty(idx, value.type());
- else if (value.type() == QVariant::String)
+ switch (value.metaType().id()) {
+ case QMetaType::QIcon:
+ case QMetaType::QPixmap:
+ d->addResourceProperty(idx, value.metaType().id());
+ break;
+ case QMetaType::QString:
d->addStringProperty(idx);
- else if (value.type() == QVariant::KeySequence)
+ break;
+ case QMetaType::QKeySequence:
d->addKeySequenceProperty(idx);
+ break;
+ }
return idx;
}
@@ -789,18 +802,18 @@ int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QV
info.defaultValue = value;
info.kind = QDesignerPropertySheetPrivate::DynamicProperty;
setPropertyGroup(index, tr("Dynamic Properties"));
- switch (value.type()) {
- case QVariant::Icon:
- case QVariant::Pixmap:
- d->addResourceProperty(index, value.type());
+ switch (value.metaType().id()) {
+ case QMetaType::QIcon:
+ case QMetaType::QPixmap:
+ d->addResourceProperty(index, value.metaType().id());
break;
- case QVariant::String:
+ case QMetaType::QString:
d->addStringProperty(index);
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
d->addStringListProperty(index);
break;
- case QVariant::KeySequence:
+ case QMetaType::QKeySequence:
d->addKeySequenceProperty(index);
break;
default:
@@ -912,12 +925,17 @@ int QDesignerPropertySheet::createFakeProperty(const QString &propertyName, cons
info.visible = false;
info.kind = QDesignerPropertySheetPrivate::FakeProperty;
QVariant v = value.isValid() ? value : metaProperty(index);
- if (v.type() == QVariant::String)
+ switch (v.metaType().id()) {
+ case QMetaType::QString:
v = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
- if (v.type() == QVariant::StringList)
+ break;
+ case QMetaType::QStringList:
v = QVariant::fromValue(qdesigner_internal::PropertySheetStringListValue());
- if (v.type() == QVariant::KeySequence)
+ break;
+ case QMetaType::QKeySequence:
v = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue());
+ break;
+ }
d->m_fakeProperties.insert(index, v);
return index;
}
@@ -1143,12 +1161,12 @@ void QDesignerPropertySheet::setFakeProperty(int index, const QVariant &value)
qdesigner_internal::PropertySheetFlagValue f = qvariant_cast<qdesigner_internal::PropertySheetFlagValue>(v);
f.value = value.toInt();
v.setValue(f);
- Q_ASSERT(value.type() == QVariant::Int);
+ Q_ASSERT(value.metaType().id() == QMetaType::Int);
} else if (v.canConvert<qdesigner_internal::PropertySheetEnumValue>()) {
qdesigner_internal::PropertySheetEnumValue e = qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(v);
e.value = value.toInt();
v.setValue(e);
- Q_ASSERT(value.type() == QVariant::Int);
+ Q_ASSERT(value.metaType().id() == QMetaType::Int);
} else {
v = value;
}
@@ -1161,7 +1179,7 @@ void QDesignerPropertySheet::clearFakeProperties()
// Buddy needs to be byte array, else uic won't work
static QVariant toByteArray(const QVariant &value) {
- if (value.type() == QVariant::ByteArray)
+ if (value.metaType().id() == QMetaType::QByteArray)
return value;
const QByteArray ba = value.toString().toUtf8();
return QVariant(ba);
diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
index a1c15e708..613c5d0c9 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp
+++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
@@ -1996,7 +1996,7 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
d_ptr->m_ui.splitter->restoreState(settings->value(QLatin1String(SplitterPosition)).toByteArray());
const QVariant geometry = settings->value(QLatin1String(Geometry));
- if (geometry.type() == QVariant::ByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374
+ if (geometry.metaType().id() == QMetaType::QByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374
restoreGeometry(geometry.toByteArray());
settings->endGroup();
diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp
index 292329e2e..fa40394b5 100644
--- a/src/designer/src/lib/shared/qtresourceview.cpp
+++ b/src/designer/src/lib/shared/qtresourceview.cpp
@@ -847,7 +847,7 @@ QtResourceViewDialog::QtResourceViewDialog(QDesignerFormEditorInterface *core, Q
settings->beginGroup(QLatin1String(ResourceViewDialogC));
const QVariant geometry = settings->value(QLatin1String(Geometry));
- if (geometry.type() == QVariant::ByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374.
+ if (geometry.metaType().id() == QMetaType::QByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374.
restoreGeometry(geometry.toByteArray());
settings->endGroup();
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index 8711e1349..6c93c2c1d 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -1454,7 +1454,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
const QVariant v = prop.read(obj);
DomProperty *dom_prop = nullptr;
- if (v.type() == QVariant::Int) {
+ if (v.metaType().id() == QMetaType::Int) {
dom_prop = new DomProperty();
if (prop.isFlagType())
diff --git a/src/designer/src/lib/uilib/properties.cpp b/src/designer/src/lib/uilib/properties.cpp
index 253196f2f..d7ba8cef1 100644
--- a/src/designer/src/lib/uilib/properties.cpp
+++ b/src/designer/src/lib/uilib/properties.cpp
@@ -75,7 +75,7 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
switch(p->kind()) {
case DomProperty::String: {
const int index = meta->indexOfProperty(p->attributeName().toUtf8());
- if (index != -1 && meta->property(index).type() == QVariant::KeySequence)
+ if (index != -1 && meta->property(index).metaType().id() == QMetaType::QKeySequence)
return QVariant::fromValue(QKeySequence(p->elementString()->text()));
}
break;
@@ -325,8 +325,8 @@ QVariant domPropertyToVariant(const DomProperty *p)
// Apply a simple variant type to a DOM property
static bool applySimpleProperty(const QVariant &v, bool translateString, DomProperty *dom_prop)
{
- switch (v.type()) {
- case QVariant::String: {
+ switch (v.metaType().id()) {
+ case QMetaType::QString: {
DomString *str = new DomString();
str->setText(v.toString());
if (!translateString)
@@ -335,35 +335,35 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
dom_prop->setElementCstring(QString::fromUtf8(v.toByteArray()));
return true;
- case QVariant::Int:
+ case QMetaType::Int:
dom_prop->setElementNumber(v.toInt());
return true;
- case QVariant::UInt:
+ case QMetaType::UInt:
dom_prop->setElementUInt(v.toUInt());
return true;
- case QVariant::LongLong:
+ case QMetaType::LongLong:
dom_prop->setElementLongLong(v.toLongLong());
return true;
- case QVariant::ULongLong:
+ case QMetaType::ULongLong:
dom_prop->setElementULongLong(v.toULongLong());
return true;
- case QVariant::Double:
+ case QMetaType::Double:
dom_prop->setElementDouble(v.toDouble());
return true;
- case QVariant::Bool:
+ case QMetaType::Bool:
dom_prop->setElementBool(v.toBool() ? QFormBuilderStrings::instance().trueValue : QFormBuilderStrings::instance().falseValue);
return true;
- case QVariant::Char: {
+ case QMetaType::QChar: {
DomChar *ch = new DomChar();
const QChar character = v.toChar();
ch->setElementUnicode(character.unicode());
@@ -371,7 +371,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Point: {
+ case QMetaType::QPoint: {
DomPoint *pt = new DomPoint();
const QPoint point = v.toPoint();
pt->setElementX(point.x());
@@ -380,7 +380,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::PointF: {
+ case QMetaType::QPointF: {
DomPointF *ptf = new DomPointF();
const QPointF pointf = v.toPointF();
ptf->setElementX(pointf.x());
@@ -389,7 +389,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Color: {
+ case QMetaType::QColor: {
DomColor *clr = new DomColor();
const QColor color = qvariant_cast<QColor>(v);
clr->setElementRed(color.red());
@@ -402,7 +402,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Size: {
+ case QMetaType::QSize: {
DomSize *sz = new DomSize();
const QSize size = v.toSize();
sz->setElementWidth(size.width());
@@ -411,7 +411,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::SizeF: {
+ case QMetaType::QSizeF: {
DomSizeF *szf = new DomSizeF();
const QSizeF sizef = v.toSizeF();
szf->setElementWidth(sizef.width());
@@ -420,7 +420,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Rect: {
+ case QMetaType::QRect: {
DomRect *rc = new DomRect();
const QRect rect = v.toRect();
rc->setElementX(rect.x());
@@ -431,7 +431,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::RectF: {
+ case QMetaType::QRectF: {
DomRectF *rcf = new DomRectF();
const QRectF rectf = v.toRectF();
rcf->setElementX(rectf.x());
@@ -442,7 +442,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Font: {
+ case QMetaType::QFont: {
DomFont *fnt = new DomFont();
const QFont font = qvariant_cast<QFont>(v);
const uint mask = font.resolveMask();
@@ -469,21 +469,21 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
return true;
#if QT_CONFIG(cursor)
- case QVariant::Cursor: {
+ case QMetaType::QCursor: {
const QMetaEnum cursorShape_enum = metaEnum<QAbstractFormBuilderGadget>("cursorShape");
dom_prop->setElementCursorShape(QLatin1String(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
}
return true;
#endif
- case QVariant::KeySequence: {
+ case QMetaType::QKeySequence: {
DomString *s = new DomString();
s->setText(qvariant_cast<QKeySequence>(v).toString(QKeySequence::PortableText));
dom_prop->setElementString(s);
}
return true;
- case QVariant::Locale: {
+ case QMetaType::QLocale: {
DomLocale *dom = new DomLocale();
const QLocale locale = qvariant_cast<QLocale>(v);
@@ -497,7 +497,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::SizePolicy: {
+ case QMetaType::QSizePolicy: {
DomSizePolicy *dom = new DomSizePolicy();
const QSizePolicy sizePolicy = qvariant_cast<QSizePolicy>(v);
@@ -513,7 +513,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Date: {
+ case QMetaType::QDate: {
DomDate *dom = new DomDate();
const QDate date = qvariant_cast<QDate>(v);
@@ -525,7 +525,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Time: {
+ case QMetaType::QTime: {
DomTime *dom = new DomTime();
const QTime time = qvariant_cast<QTime>(v);
@@ -537,7 +537,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::DateTime: {
+ case QMetaType::QDateTime: {
DomDateTime *dom = new DomDateTime();
const QDateTime dateTime = qvariant_cast<QDateTime>(v);
@@ -552,7 +552,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::Url: {
+ case QMetaType::QUrl: {
DomUrl *dom = new DomUrl();
const QUrl url = v.toUrl();
@@ -564,7 +564,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
}
return true;
- case QVariant::StringList: {
+ case QMetaType::QStringList: {
DomStringList *sl = new DomStringList;
sl->setElementString(qvariant_cast<QStringList>(v));
dom_prop->setElementStringList(sl);
@@ -598,8 +598,10 @@ static bool isTranslatable(const QString &pname, const QVariant &v, const QMetaO
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
if (pname == strings.objectNameProperty)
return false;
- if (pname == strings.styleSheetProperty && v.type() == QVariant::String && isOfType(meta, &QWidget::staticMetaObject))
+ if (pname == strings.styleSheetProperty && v.metaType().id() == QMetaType::QString
+ && isOfType(meta, &QWidget::staticMetaObject)) {
return false;
+ }
return true;
}
@@ -616,7 +618,7 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *
const int pindex = meta->indexOfProperty(pname.toLatin1());
if (pindex != -1) {
QMetaProperty meta_property = meta->property(pindex);
- if ((v.type() == QVariant::Int || v.type() == QVariant::UInt) && meta_property.isEnumType()) {
+ if ((v.metaType().id() == QMetaType::Int || v.metaType().id() == QMetaType::UInt) && meta_property.isEnumType()) {
const QMetaEnum e = meta_property.enumerator();
if (e.isFlag())
dom_prop->setElementSet(QString::fromLatin1(e.valueToKeys(v.toInt())));
@@ -633,8 +635,8 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *
return dom_prop;
// Complex properties
- switch (v.type()) {
- case QVariant::Palette: {
+ switch (v.metaType().id()) {
+ case QMetaType::QPalette: {
DomPalette *dom = new DomPalette();
QPalette palette = qvariant_cast<QPalette>(v);
@@ -649,7 +651,7 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *
dom_prop->setElementPalette(dom);
} break;
- case QVariant::Brush:
+ case QMetaType::QBrush:
dom_prop->setElementBrush(afb->saveBrush(qvariant_cast<QBrush>(v)));
break;
default: {
diff --git a/src/designer/src/lib/uilib/resourcebuilder.cpp b/src/designer/src/lib/uilib/resourcebuilder.cpp
index 78960fce8..eb9cb2728 100644
--- a/src/designer/src/lib/uilib/resourcebuilder.cpp
+++ b/src/designer/src/lib/uilib/resourcebuilder.cpp
@@ -155,9 +155,9 @@ bool QResourceBuilder::isResourceProperty(const DomProperty *p) const
bool QResourceBuilder::isResourceType(const QVariant &value) const
{
- switch (value.type()) {
- case QVariant::Pixmap:
- case QVariant::Icon:
+ switch (value.metaType().id()) {
+ case QMetaType::QPixmap:
+ case QMetaType::QIcon:
return true;
default:
break;
diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.cpp b/src/shared/qtpropertybrowser/qtvariantproperty.cpp
index dd7bad01f..2c36d887b 100644
--- a/src/shared/qtpropertybrowser/qtvariantproperty.cpp
+++ b/src/shared/qtpropertybrowser/qtvariantproperty.cpp
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
Returns the type id for an enum property.
Note that the property's value type can be retrieved using the
- valueType() function (which is QVariant::Int for the enum property
+ valueType() function (which is QMetaType::Int for the enum property
type).
\sa propertyType(), valueType()
@@ -92,7 +92,7 @@ int QtVariantPropertyManager::enumTypeId()
Returns the type id for a flag property.
Note that the property's value type can be retrieved using the
- valueType() function (which is QVariant::Int for the flag property
+ valueType() function (which is QMetaType::Int for the flag property
type).
\sa propertyType(), valueType()
@@ -106,7 +106,7 @@ int QtVariantPropertyManager::flagTypeId()
Returns the type id for a group property.
Note that the property's value type can be retrieved using the
- valueType() function (which is QVariant::Invalid for the group
+ valueType() function (which is QMetaType::UnknownType for the group
property type, since it doesn't provide any value).
\sa propertyType(), valueType()
@@ -374,13 +374,13 @@ int QtVariantPropertyManagerPrivate::internalPropertyToType(QtProperty *property
int type = 0;
QtAbstractPropertyManager *internPropertyManager = property->propertyManager();
if (qobject_cast<QtIntPropertyManager *>(internPropertyManager))
- type = QVariant::Int;
+ type = QMetaType::Int;
else if (qobject_cast<QtEnumPropertyManager *>(internPropertyManager))
type = QtVariantPropertyManager::enumTypeId();
else if (qobject_cast<QtBoolPropertyManager *>(internPropertyManager))
- type = QVariant::Bool;
+ type = QMetaType::Bool;
else if (qobject_cast<QtDoublePropertyManager *>(internPropertyManager))
- type = QVariant::Double;
+ type = QMetaType::Double;
return type;
}
@@ -682,13 +682,13 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property,
the type of its value, can be retrieved using the propertyType()
and valueType() functions respectively.
- A property's type is a QVariant::Type enumerator value, and
+ A property's type is a QMetaType::QType enumerator value, and
usually a property's type is the same as its value type. But for
some properties the types differ, for example for enums, flags and
group types in which case QtVariantPropertyManager provides the
enumTypeId(), flagTypeId() and groupTypeId() functions,
respectively, to identify their property type (the value types are
- QVariant::Int for the enum and flag types, and QVariant::Invalid
+ QMetaType::Int for the enum and flag types, and QMetaType::UnknownType
for the group type).
Use the isPropertyTypeSupported() function to check if a particular
@@ -701,64 +701,64 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property,
\li Property Type Id
\row
\li int
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li double
- \li QVariant::Double
+ \li QMetaType::Double
\row
\li bool
- \li QVariant::Bool
+ \li QMetaType::Bool
\row
\li QString
- \li QVariant::String
+ \li QMetaType::QString
\row
\li QDate
- \li QVariant::Date
+ \li QMetaType::QDate
\row
\li QTime
- \li QVariant::Time
+ \li QMetaType::QTime
\row
\li QDateTime
- \li QVariant::DateTime
+ \li QMetaType::QDateTime
\row
\li QKeySequence
- \li QVariant::KeySequence
+ \li QMetaType::QKeySequence
\row
\li QChar
- \li QVariant::Char
+ \li QMetaType::QChar
\row
\li QLocale
- \li QVariant::Locale
+ \li QMetaType::QLocale
\row
\li QPoint
- \li QVariant::Point
+ \li QMetaType::QPoint
\row
\li QPointF
- \li QVariant::PointF
+ \li QMetaType::QPointF
\row
\li QSize
- \li QVariant::Size
+ \li QMetaType::QSize
\row
\li QSizeF
- \li QVariant::SizeF
+ \li QMetaType::QSizeF
\row
\li QRect
- \li QVariant::Rect
+ \li QMetaType::QRect
\row
\li QRectF
- \li QVariant::RectF
+ \li QMetaType::QRectF
\row
\li QColor
- \li QVariant::Color
+ \li QMetaType::QColor
\row
\li QSizePolicy
- \li QVariant::SizePolicy
+ \li QMetaType::QSizePolicy
\row
\li QFont
- \li QVariant::Font
+ \li QMetaType::QFont
\row
\li QCursor
- \li QVariant::Cursor
+ \li QMetaType::QCursor
\row
\li enum
\li enumTypeId()
@@ -771,7 +771,7 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property,
\endtable
Each property type can provide additional attributes,
- e.g. QVariant::Int and QVariant::Double provides minimum and
+ e.g. QMetaType::Int and QMetaType::Double provides minimum and
maximum values. The currently supported attributes are:
\table
@@ -782,83 +782,83 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property,
\row
\li \c int
\li minimum
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li
\li maximum
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li
\li singleStep
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li \c double
\li minimum
- \li QVariant::Double
+ \li QMetaType::Double
\row
\li
\li maximum
- \li QVariant::Double
+ \li QMetaType::Double
\row
\li
\li singleStep
- \li QVariant::Double
+ \li QMetaType::Double
\row
\li
\li decimals
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li QString
\li regExp
- \li QVariant::RegExp
+ \li QMetaType::QRegExp
\row
\li QDate
\li minimum
- \li QVariant::Date
+ \li QMetaType::QDate
\row
\li
\li maximum
- \li QVariant::Date
+ \li QMetaType::QDate
\row
\li QPointF
\li decimals
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li QSize
\li minimum
- \li QVariant::Size
+ \li QMetaType::QSize
\row
\li
\li maximum
- \li QVariant::Size
+ \li QMetaType::QSize
\row
\li QSizeF
\li minimum
- \li QVariant::SizeF
+ \li QMetaType::QSizeF
\row
\li
\li maximum
- \li QVariant::SizeF
+ \li QMetaType::QSizeF
\row
\li
\li decimals
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li QRect
\li constraint
- \li QVariant::Rect
+ \li QMetaType::QRect
\row
\li QRectF
\li constraint
- \li QVariant::RectF
+ \li QMetaType::QRectF
\row
\li
\li decimals
- \li QVariant::Int
+ \li QMetaType::Int
\row
\li \c enum
\li enumNames
- \li QVariant::StringList
+ \li QMetaType::QStringList
\row
\li
\li enumIcons
@@ -866,7 +866,7 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property,
\row
\li \c flag
\li flagNames
- \li QVariant::StringList
+ \li QMetaType::QStringList
\endtable
The attributes for a given property type can be retrieved using
@@ -919,11 +919,11 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
// IntPropertyManager
QtIntPropertyManager *intPropertyManager = new QtIntPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Int] = intPropertyManager;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_minimumAttribute] = QVariant::Int;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_maximumAttribute] = QVariant::Int;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_singleStepAttribute] = QVariant::Int;
- d_ptr->m_typeToValueType[QVariant::Int] = QVariant::Int;
+ d_ptr->m_typeToPropertyManager[QMetaType::Int] = intPropertyManager;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Int][d_ptr->m_minimumAttribute] = QMetaType::Int;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Int][d_ptr->m_maximumAttribute] = QMetaType::Int;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Int][d_ptr->m_singleStepAttribute] = QMetaType::Int;
+ d_ptr->m_typeToValueType[QMetaType::Int] = QMetaType::Int;
connect(intPropertyManager, SIGNAL(valueChanged(QtProperty*,int)),
this, SLOT(slotValueChanged(QtProperty*,int)));
connect(intPropertyManager, SIGNAL(rangeChanged(QtProperty*,int,int)),
@@ -932,16 +932,16 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotSingleStepChanged(QtProperty*,int)));
// DoublePropertyManager
QtDoublePropertyManager *doublePropertyManager = new QtDoublePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Double] = doublePropertyManager;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_minimumAttribute] =
- QVariant::Double;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_maximumAttribute] =
- QVariant::Double;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_singleStepAttribute] =
- QVariant::Double;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_decimalsAttribute] =
- QVariant::Int;
- d_ptr->m_typeToValueType[QVariant::Double] = QVariant::Double;
+ d_ptr->m_typeToPropertyManager[QMetaType::Double] = doublePropertyManager;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Double][d_ptr->m_minimumAttribute] =
+ QMetaType::Double;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Double][d_ptr->m_maximumAttribute] =
+ QMetaType::Double;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Double][d_ptr->m_singleStepAttribute] =
+ QMetaType::Double;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::Double][d_ptr->m_decimalsAttribute] =
+ QMetaType::Int;
+ d_ptr->m_typeToValueType[QMetaType::Double] = QMetaType::Double;
connect(doublePropertyManager, SIGNAL(valueChanged(QtProperty*,double)),
this, SLOT(slotValueChanged(QtProperty*,double)));
connect(doublePropertyManager, SIGNAL(rangeChanged(QtProperty*,double,double)),
@@ -952,60 +952,60 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotDecimalsChanged(QtProperty*,int)));
// BoolPropertyManager
QtBoolPropertyManager *boolPropertyManager = new QtBoolPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Bool] = boolPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Bool] = QVariant::Bool;
+ d_ptr->m_typeToPropertyManager[QMetaType::Bool] = boolPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::Bool] = QMetaType::Bool;
connect(boolPropertyManager, SIGNAL(valueChanged(QtProperty*,bool)),
this, SLOT(slotValueChanged(QtProperty*,bool)));
// StringPropertyManager
QtStringPropertyManager *stringPropertyManager = new QtStringPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::String] = stringPropertyManager;
- d_ptr->m_typeToValueType[QVariant::String] = QVariant::String;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::String][d_ptr->m_regExpAttribute] =
- QVariant::RegularExpression;
+ d_ptr->m_typeToPropertyManager[QMetaType::QString] = stringPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QString] = QMetaType::QString;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QString][d_ptr->m_regExpAttribute] =
+ QMetaType::QRegularExpression;
connect(stringPropertyManager, SIGNAL(valueChanged(QtProperty*,QString)),
this, SLOT(slotValueChanged(QtProperty*,QString)));
connect(stringPropertyManager, SIGNAL(regExpChanged(QtProperty*,QRegularExpression)),
this, SLOT(slotRegExpChanged(QtProperty*,QRegularExpression)));
// DatePropertyManager
QtDatePropertyManager *datePropertyManager = new QtDatePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Date] = datePropertyManager;
- d_ptr->m_typeToValueType[QVariant::Date] = QVariant::Date;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Date][d_ptr->m_minimumAttribute] =
- QVariant::Date;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Date][d_ptr->m_maximumAttribute] =
- QVariant::Date;
+ d_ptr->m_typeToPropertyManager[QMetaType::QDate] = datePropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QDate] = QMetaType::QDate;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QDate][d_ptr->m_minimumAttribute] =
+ QMetaType::QDate;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QDate][d_ptr->m_maximumAttribute] =
+ QMetaType::QDate;
connect(datePropertyManager, SIGNAL(valueChanged(QtProperty*,QDate)),
this, SLOT(slotValueChanged(QtProperty*,QDate)));
connect(datePropertyManager, SIGNAL(rangeChanged(QtProperty*,QDate,QDate)),
this, SLOT(slotRangeChanged(QtProperty*,QDate,QDate)));
// TimePropertyManager
QtTimePropertyManager *timePropertyManager = new QtTimePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Time] = timePropertyManager;
- d_ptr->m_typeToValueType[QVariant::Time] = QVariant::Time;
+ d_ptr->m_typeToPropertyManager[QMetaType::QTime] = timePropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QTime] = QMetaType::QTime;
connect(timePropertyManager, SIGNAL(valueChanged(QtProperty*,QTime)),
this, SLOT(slotValueChanged(QtProperty*,QTime)));
// DateTimePropertyManager
QtDateTimePropertyManager *dateTimePropertyManager = new QtDateTimePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::DateTime] = dateTimePropertyManager;
- d_ptr->m_typeToValueType[QVariant::DateTime] = QVariant::DateTime;
+ d_ptr->m_typeToPropertyManager[QMetaType::QDateTime] = dateTimePropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QDateTime] = QMetaType::QDateTime;
connect(dateTimePropertyManager, SIGNAL(valueChanged(QtProperty*,QDateTime)),
this, SLOT(slotValueChanged(QtProperty*,QDateTime)));
// KeySequencePropertyManager
QtKeySequencePropertyManager *keySequencePropertyManager = new QtKeySequencePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::KeySequence] = keySequencePropertyManager;
- d_ptr->m_typeToValueType[QVariant::KeySequence] = QVariant::KeySequence;
+ d_ptr->m_typeToPropertyManager[QMetaType::QKeySequence] = keySequencePropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QKeySequence] = QMetaType::QKeySequence;
connect(keySequencePropertyManager, SIGNAL(valueChanged(QtProperty*,QKeySequence)),
this, SLOT(slotValueChanged(QtProperty*,QKeySequence)));
// CharPropertyManager
QtCharPropertyManager *charPropertyManager = new QtCharPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Char] = charPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Char] = QVariant::Char;
+ d_ptr->m_typeToPropertyManager[QMetaType::QChar] = charPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QChar] = QMetaType::QChar;
connect(charPropertyManager, SIGNAL(valueChanged(QtProperty*,QChar)),
this, SLOT(slotValueChanged(QtProperty*,QChar)));
// LocalePropertyManager
QtLocalePropertyManager *localePropertyManager = new QtLocalePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Locale] = localePropertyManager;
- d_ptr->m_typeToValueType[QVariant::Locale] = QVariant::Locale;
+ d_ptr->m_typeToPropertyManager[QMetaType::QLocale] = localePropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QLocale] = QMetaType::QLocale;
connect(localePropertyManager, SIGNAL(valueChanged(QtProperty*,QLocale)),
this, SLOT(slotValueChanged(QtProperty*,QLocale)));
connect(localePropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)),
@@ -1016,8 +1016,8 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// PointPropertyManager
QtPointPropertyManager *pointPropertyManager = new QtPointPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Point] = pointPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Point] = QVariant::Point;
+ d_ptr->m_typeToPropertyManager[QMetaType::QPoint] = pointPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QPoint] = QMetaType::QPoint;
connect(pointPropertyManager, SIGNAL(valueChanged(QtProperty*,QPoint)),
this, SLOT(slotValueChanged(QtProperty*,QPoint)));
connect(pointPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)),
@@ -1028,10 +1028,10 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// PointFPropertyManager
QtPointFPropertyManager *pointFPropertyManager = new QtPointFPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::PointF] = pointFPropertyManager;
- d_ptr->m_typeToValueType[QVariant::PointF] = QVariant::PointF;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::PointF][d_ptr->m_decimalsAttribute] =
- QVariant::Int;
+ d_ptr->m_typeToPropertyManager[QMetaType::QPointF] = pointFPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QPointF] = QMetaType::QPointF;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QPointF][d_ptr->m_decimalsAttribute] =
+ QMetaType::Int;
connect(pointFPropertyManager, SIGNAL(valueChanged(QtProperty*,QPointF)),
this, SLOT(slotValueChanged(QtProperty*,QPointF)));
connect(pointFPropertyManager, SIGNAL(decimalsChanged(QtProperty*,int)),
@@ -1044,12 +1044,12 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// SizePropertyManager
QtSizePropertyManager *sizePropertyManager = new QtSizePropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Size] = sizePropertyManager;
- d_ptr->m_typeToValueType[QVariant::Size] = QVariant::Size;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Size][d_ptr->m_minimumAttribute] =
- QVariant::Size;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Size][d_ptr->m_maximumAttribute] =
- QVariant::Size;
+ d_ptr->m_typeToPropertyManager[QMetaType::QSize] = sizePropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QSize] = QMetaType::QSize;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QSize][d_ptr->m_minimumAttribute] =
+ QMetaType::QSize;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QSize][d_ptr->m_maximumAttribute] =
+ QMetaType::QSize;
connect(sizePropertyManager, SIGNAL(valueChanged(QtProperty*,QSize)),
this, SLOT(slotValueChanged(QtProperty*,QSize)));
connect(sizePropertyManager, SIGNAL(rangeChanged(QtProperty*,QSize,QSize)),
@@ -1064,14 +1064,14 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// SizeFPropertyManager
QtSizeFPropertyManager *sizeFPropertyManager = new QtSizeFPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::SizeF] = sizeFPropertyManager;
- d_ptr->m_typeToValueType[QVariant::SizeF] = QVariant::SizeF;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_minimumAttribute] =
- QVariant::SizeF;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_maximumAttribute] =
- QVariant::SizeF;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_decimalsAttribute] =
- QVariant::Int;
+ d_ptr->m_typeToPropertyManager[QMetaType::QSizeF] = sizeFPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QSizeF] = QMetaType::QSizeF;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QSizeF][d_ptr->m_minimumAttribute] =
+ QMetaType::QSizeF;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QSizeF][d_ptr->m_maximumAttribute] =
+ QMetaType::QSizeF;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QSizeF][d_ptr->m_decimalsAttribute] =
+ QMetaType::Int;
connect(sizeFPropertyManager, SIGNAL(valueChanged(QtProperty*,QSizeF)),
this, SLOT(slotValueChanged(QtProperty*,QSizeF)));
connect(sizeFPropertyManager, SIGNAL(rangeChanged(QtProperty*,QSizeF,QSizeF)),
@@ -1088,10 +1088,10 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// RectPropertyManager
QtRectPropertyManager *rectPropertyManager = new QtRectPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Rect] = rectPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Rect] = QVariant::Rect;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::Rect][d_ptr->m_constraintAttribute] =
- QVariant::Rect;
+ d_ptr->m_typeToPropertyManager[QMetaType::QRect] = rectPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QRect] = QMetaType::QRect;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QRect][d_ptr->m_constraintAttribute] =
+ QMetaType::QRect;
connect(rectPropertyManager, SIGNAL(valueChanged(QtProperty*,QRect)),
this, SLOT(slotValueChanged(QtProperty*,QRect)));
connect(rectPropertyManager, SIGNAL(constraintChanged(QtProperty*,QRect)),
@@ -1106,12 +1106,12 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// RectFPropertyManager
QtRectFPropertyManager *rectFPropertyManager = new QtRectFPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::RectF] = rectFPropertyManager;
- d_ptr->m_typeToValueType[QVariant::RectF] = QVariant::RectF;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::RectF][d_ptr->m_constraintAttribute] =
- QVariant::RectF;
- d_ptr->m_typeToAttributeToAttributeType[QVariant::RectF][d_ptr->m_decimalsAttribute] =
- QVariant::Int;
+ d_ptr->m_typeToPropertyManager[QMetaType::QRectF] = rectFPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QRectF] = QMetaType::QRectF;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QRectF][d_ptr->m_constraintAttribute] =
+ QMetaType::QRectF;
+ d_ptr->m_typeToAttributeToAttributeType[QMetaType::QRectF][d_ptr->m_decimalsAttribute] =
+ QMetaType::Int;
connect(rectFPropertyManager, SIGNAL(valueChanged(QtProperty*,QRectF)),
this, SLOT(slotValueChanged(QtProperty*,QRectF)));
connect(rectFPropertyManager, SIGNAL(constraintChanged(QtProperty*,QRectF)),
@@ -1128,8 +1128,8 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// ColorPropertyManager
QtColorPropertyManager *colorPropertyManager = new QtColorPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Color] = colorPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Color] = QVariant::Color;
+ d_ptr->m_typeToPropertyManager[QMetaType::QColor] = colorPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QColor] = QMetaType::QColor;
connect(colorPropertyManager, SIGNAL(valueChanged(QtProperty*,QColor)),
this, SLOT(slotValueChanged(QtProperty*,QColor)));
connect(colorPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)),
@@ -1142,9 +1142,9 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
int enumId = enumTypeId();
QtEnumPropertyManager *enumPropertyManager = new QtEnumPropertyManager(this);
d_ptr->m_typeToPropertyManager[enumId] = enumPropertyManager;
- d_ptr->m_typeToValueType[enumId] = QVariant::Int;
+ d_ptr->m_typeToValueType[enumId] = QMetaType::Int;
d_ptr->m_typeToAttributeToAttributeType[enumId][d_ptr->m_enumNamesAttribute] =
- QVariant::StringList;
+ QMetaType::QStringList;
d_ptr->m_typeToAttributeToAttributeType[enumId][d_ptr->m_enumIconsAttribute] =
iconMapTypeId();
connect(enumPropertyManager, SIGNAL(valueChanged(QtProperty*,int)),
@@ -1155,8 +1155,8 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotEnumIconsChanged(QtProperty*,QMap<int,QIcon>)));
// SizePolicyPropertyManager
QtSizePolicyPropertyManager *sizePolicyPropertyManager = new QtSizePolicyPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::SizePolicy] = sizePolicyPropertyManager;
- d_ptr->m_typeToValueType[QVariant::SizePolicy] = QVariant::SizePolicy;
+ d_ptr->m_typeToPropertyManager[QMetaType::QSizePolicy] = sizePolicyPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QSizePolicy] = QMetaType::QSizePolicy;
connect(sizePolicyPropertyManager, SIGNAL(valueChanged(QtProperty*,QSizePolicy)),
this, SLOT(slotValueChanged(QtProperty*,QSizePolicy)));
connect(sizePolicyPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)),
@@ -1174,8 +1174,8 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// FontPropertyManager
QtFontPropertyManager *fontPropertyManager = new QtFontPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Font] = fontPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Font] = QVariant::Font;
+ d_ptr->m_typeToPropertyManager[QMetaType::QFont] = fontPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QFont] = QMetaType::QFont;
connect(fontPropertyManager, SIGNAL(valueChanged(QtProperty*,QFont)),
this, SLOT(slotValueChanged(QtProperty*,QFont)));
connect(fontPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)),
@@ -1195,17 +1195,17 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*)));
// CursorPropertyManager
QtCursorPropertyManager *cursorPropertyManager = new QtCursorPropertyManager(this);
- d_ptr->m_typeToPropertyManager[QVariant::Cursor] = cursorPropertyManager;
- d_ptr->m_typeToValueType[QVariant::Cursor] = QVariant::Cursor;
+ d_ptr->m_typeToPropertyManager[QMetaType::QCursor] = cursorPropertyManager;
+ d_ptr->m_typeToValueType[QMetaType::QCursor] = QMetaType::QCursor;
connect(cursorPropertyManager, SIGNAL(valueChanged(QtProperty*,QCursor)),
this, SLOT(slotValueChanged(QtProperty*,QCursor)));
// FlagPropertyManager
int flagId = flagTypeId();
QtFlagPropertyManager *flagPropertyManager = new QtFlagPropertyManager(this);
d_ptr->m_typeToPropertyManager[flagId] = flagPropertyManager;
- d_ptr->m_typeToValueType[flagId] = QVariant::Int;
+ d_ptr->m_typeToValueType[flagId] = QMetaType::Int;
d_ptr->m_typeToAttributeToAttributeType[flagId][d_ptr->m_flagNamesAttribute] =
- QVariant::StringList;
+ QMetaType::QStringList;
connect(flagPropertyManager, SIGNAL(valueChanged(QtProperty*,int)),
this, SLOT(slotValueChanged(QtProperty*,int)));
connect(flagPropertyManager, SIGNAL(flagNamesChanged(QtProperty*,QStringList)),
@@ -1220,7 +1220,7 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent)
int groupId = groupTypeId();
QtGroupPropertyManager *groupPropertyManager = new QtGroupPropertyManager(this);
d_ptr->m_typeToPropertyManager[groupId] = groupPropertyManager;
- d_ptr->m_typeToValueType[groupId] = QVariant::Invalid;
+ d_ptr->m_typeToValueType[groupId] = QMetaType::UnknownType;
}
/*!
@@ -1518,7 +1518,7 @@ QStringList QtVariantPropertyManager::attributes(int propertyType) const
If the given \a propertyType is not supported by \e this manager,
or if the given \a propertyType does not possess the specified \a
- attribute, this function returns QVariant::Invalid.
+ attribute, this function returns QMetaType::UnknownType.
\sa attributes(), valueType()
*/
@@ -1927,52 +1927,52 @@ QtVariantEditorFactory::QtVariantEditorFactory(QObject *parent)
d_ptr->q_ptr = this;
d_ptr->m_spinBoxFactory = new QtSpinBoxFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_spinBoxFactory] = QVariant::Int;
- d_ptr->m_typeToFactory[QVariant::Int] = d_ptr->m_spinBoxFactory;
+ d_ptr->m_factoryToType[d_ptr->m_spinBoxFactory] = QMetaType::Int;
+ d_ptr->m_typeToFactory[QMetaType::Int] = d_ptr->m_spinBoxFactory;
d_ptr->m_doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_doubleSpinBoxFactory] = QVariant::Double;
- d_ptr->m_typeToFactory[QVariant::Double] = d_ptr->m_doubleSpinBoxFactory;
+ d_ptr->m_factoryToType[d_ptr->m_doubleSpinBoxFactory] = QMetaType::Double;
+ d_ptr->m_typeToFactory[QMetaType::Double] = d_ptr->m_doubleSpinBoxFactory;
d_ptr->m_checkBoxFactory = new QtCheckBoxFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_checkBoxFactory] = QVariant::Bool;
- d_ptr->m_typeToFactory[QVariant::Bool] = d_ptr->m_checkBoxFactory;
+ d_ptr->m_factoryToType[d_ptr->m_checkBoxFactory] = QMetaType::Bool;
+ d_ptr->m_typeToFactory[QMetaType::Bool] = d_ptr->m_checkBoxFactory;
d_ptr->m_lineEditFactory = new QtLineEditFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_lineEditFactory] = QVariant::String;
- d_ptr->m_typeToFactory[QVariant::String] = d_ptr->m_lineEditFactory;
+ d_ptr->m_factoryToType[d_ptr->m_lineEditFactory] = QMetaType::QString;
+ d_ptr->m_typeToFactory[QMetaType::QString] = d_ptr->m_lineEditFactory;
d_ptr->m_dateEditFactory = new QtDateEditFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_dateEditFactory] = QVariant::Date;
- d_ptr->m_typeToFactory[QVariant::Date] = d_ptr->m_dateEditFactory;
+ d_ptr->m_factoryToType[d_ptr->m_dateEditFactory] = QMetaType::QDate;
+ d_ptr->m_typeToFactory[QMetaType::QDate] = d_ptr->m_dateEditFactory;
d_ptr->m_timeEditFactory = new QtTimeEditFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_timeEditFactory] = QVariant::Time;
- d_ptr->m_typeToFactory[QVariant::Time] = d_ptr->m_timeEditFactory;
+ d_ptr->m_factoryToType[d_ptr->m_timeEditFactory] = QMetaType::QTime;
+ d_ptr->m_typeToFactory[QMetaType::QTime] = d_ptr->m_timeEditFactory;
d_ptr->m_dateTimeEditFactory = new QtDateTimeEditFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_dateTimeEditFactory] = QVariant::DateTime;
- d_ptr->m_typeToFactory[QVariant::DateTime] = d_ptr->m_dateTimeEditFactory;
+ d_ptr->m_factoryToType[d_ptr->m_dateTimeEditFactory] = QMetaType::QDateTime;
+ d_ptr->m_typeToFactory[QMetaType::QDateTime] = d_ptr->m_dateTimeEditFactory;
d_ptr->m_keySequenceEditorFactory = new QtKeySequenceEditorFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_keySequenceEditorFactory] = QVariant::KeySequence;
- d_ptr->m_typeToFactory[QVariant::KeySequence] = d_ptr->m_keySequenceEditorFactory;
+ d_ptr->m_factoryToType[d_ptr->m_keySequenceEditorFactory] = QMetaType::QKeySequence;
+ d_ptr->m_typeToFactory[QMetaType::QKeySequence] = d_ptr->m_keySequenceEditorFactory;
d_ptr->m_charEditorFactory = new QtCharEditorFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_charEditorFactory] = QVariant::Char;
- d_ptr->m_typeToFactory[QVariant::Char] = d_ptr->m_charEditorFactory;
+ d_ptr->m_factoryToType[d_ptr->m_charEditorFactory] = QMetaType::QChar;
+ d_ptr->m_typeToFactory[QMetaType::QChar] = d_ptr->m_charEditorFactory;
d_ptr->m_cursorEditorFactory = new QtCursorEditorFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_cursorEditorFactory] = QVariant::Cursor;
- d_ptr->m_typeToFactory[QVariant::Cursor] = d_ptr->m_cursorEditorFactory;
+ d_ptr->m_factoryToType[d_ptr->m_cursorEditorFactory] = QMetaType::QCursor;
+ d_ptr->m_typeToFactory[QMetaType::QCursor] = d_ptr->m_cursorEditorFactory;
d_ptr->m_colorEditorFactory = new QtColorEditorFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_colorEditorFactory] = QVariant::Color;
- d_ptr->m_typeToFactory[QVariant::Color] = d_ptr->m_colorEditorFactory;
+ d_ptr->m_factoryToType[d_ptr->m_colorEditorFactory] = QMetaType::QColor;
+ d_ptr->m_typeToFactory[QMetaType::QColor] = d_ptr->m_colorEditorFactory;
d_ptr->m_fontEditorFactory = new QtFontEditorFactory(this);
- d_ptr->m_factoryToType[d_ptr->m_fontEditorFactory] = QVariant::Font;
- d_ptr->m_typeToFactory[QVariant::Font] = d_ptr->m_fontEditorFactory;
+ d_ptr->m_factoryToType[d_ptr->m_fontEditorFactory] = QMetaType::QFont;
+ d_ptr->m_typeToFactory[QMetaType::QFont] = d_ptr->m_fontEditorFactory;
d_ptr->m_comboBoxFactory = new QtEnumEditorFactory(this);
const int enumId = QtVariantPropertyManager::enumTypeId();