QmlPuppet: Move hasFullImplementedListInterface to QmlPrivateGate

Change-Id: I42a744b67811cc49b616b742da46af5502d5e1a9
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2015-05-19 16:06:19 +02:00
committed by Thomas Hartmann
parent a439335500
commit 4d4320d598
3 changed files with 11 additions and 9 deletions

View File

@@ -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<QQmlListReference>(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<QQmlListReference>(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<QQmlListReference>(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;
}

View File

@@ -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();

View File

@@ -36,6 +36,7 @@
#include <QObject>
#include <QString>
#include <QQmlContext>
#include <QQmlListReference>
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