From f4983380df800a24557b2d8c347c524fc8151aec Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@nokia.com> Date: Tue, 9 Feb 2010 14:34:35 +0100 Subject: [PATCH] Fix compilation against latest qt-dui d914555badc in qt-dui/master removed QmlType::fromObject. This patch replaces the method with QVariant::fromValue. The difference here is that the QVariant type is always QObject*, instead of the real inherited type. We have yet to verify if this breaks something. --- .../components/propertyeditor/propertyeditor.cpp | 6 +++--- .../components/propertyeditor/propertyeditorvalue.cpp | 2 +- .../qmldesigner/core/instances/objectnodeinstance.cpp | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index a07a2b7f94c..780343f9a04 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -83,7 +83,7 @@ void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const QString valueObject = new PropertyEditorValue(propertyMap); QObject::connect(valueObject, SIGNAL(valueChanged(QString)), propertyMap, SIGNAL(valueChanged(QString))); QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString))); - propertyMap->insert(propertyName, QmlMetaType::qmlType(valueObject->metaObject())->fromObject(valueObject)); + propertyMap->insert(propertyName, QVariant::fromValue(valueObject)); } valueObject->setName(propertyName); valueObject->setModelNode(fxObjectNode); @@ -129,14 +129,14 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS valueObject->setModelNode(fxObjectNode.modelNode()); valueObject->setValue(fxObjectNode.modelNode().simplifiedTypeName()); QObject::connect(valueObject, SIGNAL(valueChanged(QString)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString))); - m_backendValuesPropertyMap.insert("className", QmlMetaType::qmlType(valueObject->metaObject())->fromObject(valueObject)); + m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject)); // id valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap); valueObject->setName("id"); valueObject->setValue(fxObjectNode.id()); QObject::connect(valueObject, SIGNAL(valueChanged(QString)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString))); - m_backendValuesPropertyMap.insert("id", QmlMetaType::qmlType(valueObject->metaObject())->fromObject(valueObject)); + m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject)); // anchors m_backendAnchorBinding.setup(QmlItemNode(fxObjectNode.modelNode())); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 4fa12cf2e06..cd9335d69e8 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -306,7 +306,7 @@ void PropertyEditorNodeWrapper::setup() valueObject->setValue(fxObjectNode.instanceValue(propertyName)); connect(valueObject, SIGNAL(valueChanged(QString)), &m_valuesPropertyMap, SIGNAL(valueChanged(QString))); - m_valuesPropertyMap.insert(propertyName, QmlMetaType::qmlType(valueObject->metaObject())->fromObject(valueObject)); + m_valuesPropertyMap.insert(propertyName, QVariant::fromValue(valueObject)); } } connect(&m_valuesPropertyMap, SIGNAL(valueChanged(const QString &)), this, SLOT(changeValue(const QString&))); diff --git a/src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp b/src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp index 7d8de822916..34eb1aca71a 100644 --- a/src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp +++ b/src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp @@ -301,10 +301,7 @@ static bool isObject(const QmlMetaProperty &metaProperty) static QVariant objectToVariant(QObject *object) { - const QMetaObject *metaObject = object->metaObject(); - QmlType *qmlType = QmlMetaType::qmlType(metaObject); - - return qmlType->fromObject(object); + return QVariant::fromValue(object); } static void removeObjectFromList(const QmlMetaProperty &metaProperty, QObject *object, QmlEngine *engine) -- GitLab