diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index b4c54a7e791..53dc355f368 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -54,6 +54,17 @@ #include #include +static bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName) +{ + if (propertyName.contains(".") && propertyName.contains("__")) + return true; + + if (propertyName.count(".") > 1) + return true; + + return false; +} + namespace QmlDesigner { namespace Internal { @@ -536,6 +547,9 @@ void ObjectNodeInstance::refreshProperty(const PropertyName &name) bool ObjectNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const { + if (isPropertyBlackListed(name)) + return false; + QQmlProperty property(object(), name, context()); bool hasBinding = QQmlPropertyPrivate::binding(property); @@ -604,6 +618,9 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const // TODO: handle model nodes + if (isPropertyBlackListed(name)) + return QVariant(); + QQmlProperty property(object(), name, context()); if (property.property().isEnumType()) { QVariant value = property.read(); @@ -666,6 +683,9 @@ PropertyNameList ObjectNodeInstance::propertyNames() const QString ObjectNodeInstance::instanceType(const PropertyName &name) const { + if (isPropertyBlackListed(name)) + return QLatin1String("undefined"); + QQmlProperty property(object(), name, context()); if (!property.isValid()) return QLatin1String("undefined"); @@ -785,7 +805,13 @@ static void disableTiledBackingStore(QObject *object) Q_UNUSED(object); } -PropertyNameList propertyNameForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList()) +static void addToPropertyNameListIfNotBlackListed(PropertyNameList *propertyNameList, const PropertyName &propertyName) +{ + if (!isPropertyBlackListed(propertyName)) + propertyNameList->append(propertyName); +} + +PropertyNameList propertyNameListForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList()) { PropertyNameList propertyNameList; @@ -802,16 +828,16 @@ PropertyNameList propertyNameForWritableProperties(QObject *object, const Proper if (declarativeProperty.name() != "parent") { QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read()); if (childObject) - propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameListForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) { QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType()); valueType->setValue(metaProperty.read(object)); - propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameListForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } if (metaProperty.isReadable() && metaProperty.isWritable()) { - propertyNameList.append(baseName + PropertyName(metaProperty.name())); + addToPropertyNameListIfNotBlackListed(&propertyNameList, baseName + PropertyName(metaProperty.name())); } } @@ -823,7 +849,7 @@ static void fixResourcePathsForObject(QObject *object) if (qgetenv("QMLDESIGNER_RC_PATHS").isEmpty()) return; - PropertyNameList propertyNameList = propertyNameForWritableProperties(object); + PropertyNameList propertyNameList = propertyNameListForWritableProperties(object); foreach (const PropertyName &propertyName, propertyNameList) { QQmlProperty property(object, propertyName, QQmlEngine::contextForObject(object)); @@ -1039,7 +1065,7 @@ void ObjectNodeInstance::deactivateState() void ObjectNodeInstance::populateResetHashes() { - PropertyNameList propertyNameList = propertyNameForWritableProperties(object()); + PropertyNameList propertyNameList = propertyNameListForWritableProperties(object()); foreach (const PropertyName &propertyName, propertyNameList) { QQmlProperty property(object(), propertyName, QQmlEngine::contextForObject(object()));