From 4d4320d598ba16c7aae03c1c856265d12145bd1b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 19 May 2015 16:06:19 +0200 Subject: [PATCH] QmlPuppet: Move hasFullImplementedListInterface to QmlPrivateGate Change-Id: I42a744b67811cc49b616b742da46af5502d5e1a9 Reviewed-by: Tim Jenssen --- .../qml2puppet/instances/objectnodeinstance.cpp | 13 ++++--------- .../qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp | 5 +++++ .../qml/qmlpuppet/qmlprivategate/qmlprivategate.h | 2 ++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index b0c7fb02770..565b33f46a9 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -279,16 +279,11 @@ static QVariant objectToVariant(QObject *object) return QVariant::fromValue(object); } -static bool hasFullImplementedListInterface(const QQmlListReference &list) -{ - return list.isValid() && list.canCount() && list.canAt() && list.canAppend() && list.canClear(); -} - static void removeObjectFromList(const QQmlProperty &property, QObject *objectToBeRemoved, QQmlEngine * engine) { QQmlListReference listReference(property.object(), property.name().toUtf8(), engine); - if (!hasFullImplementedListInterface(listReference)) { + if (!QmlPrivateGate::hasFullImplementedListInterface(listReference)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } @@ -338,7 +333,7 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c if (isList(property)) { QQmlListReference list = qvariant_cast(property.read()); - if (!hasFullImplementedListInterface(list)) { + if (!QmlPrivateGate::hasFullImplementedListInterface(list)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } @@ -485,7 +480,7 @@ void ObjectNodeInstance::deleteObjectsInList(const QQmlProperty &property) QObjectList objectList; QQmlListReference list = qvariant_cast(property.read()); - if (!hasFullImplementedListInterface(list)) { + if (!QmlPrivateGate::hasFullImplementedListInterface(list)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } @@ -584,7 +579,7 @@ void ObjectNodeInstance::doResetProperty(const PropertyName &propertyName) } else if (property.propertyTypeCategory() == QQmlProperty::List) { QQmlListReference list = qvariant_cast(property.read()); - if (!hasFullImplementedListInterface(list)) { + if (!QmlPrivateGate::hasFullImplementedListInterface(list)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp index e7972357faf..e7f922b26f4 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.cpp @@ -441,6 +441,11 @@ QObject *createComponent(const QUrl &componentUrl, QQmlContext *context) return object; } +bool hasFullImplementedListInterface(const QQmlListReference &list) +{ + return list.isValid() && list.canCount() && list.canAt() && list.canAppend() && list.canClear(); +} + ComponentCompleteDisabler::ComponentCompleteDisabler() { DesignerSupport::disableComponentComplete(); diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h index aada77182e1..31d79ef3767 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h +++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h @@ -36,6 +36,7 @@ #include #include #include +#include namespace QmlDesigner { namespace Internal { @@ -75,6 +76,7 @@ public: PropertyNameList allPropertyNames(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = 0); + bool hasFullImplementedListInterface(const QQmlListReference &list); } // namespace QmlPrivateGate } // namespace Internal