QmlPuppet: Clean up private API usage in ServerNodeInstance

Change-Id: Ic0890c8c6740ad2c4567b58ec9b51933d0293fc1
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2015-05-20 18:09:54 +02:00
parent 4a0a1a2b75
commit 0321f6e1a7
3 changed files with 32 additions and 22 deletions
@@ -46,6 +46,8 @@
#include "nodeinstanceserver.h"
#include "instancecontainer.h"
#include <qmlprivategate.h>
#include <QHash>
#include <QSet>
#include <QDebug>
@@ -53,9 +55,6 @@
#include <QQmlEngine>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlengine_p.h>
/*!
\class QmlDesigner::NodeInstance
\ingroup CoreInstance
@@ -129,23 +128,7 @@ bool ServerNodeInstance::isRootNodeInstance() const
bool ServerNodeInstance::isSubclassOf(QObject *object, const QByteArray &superTypeName)
{
if (object == 0)
return false;
const QMetaObject *metaObject = object->metaObject();
while (metaObject) {
QQmlType *qmlType = QQmlMetaType::qmlType(metaObject);
if (qmlType && qmlType->qmlTypeName() == superTypeName) // ignore version numbers
return true;
if (metaObject->className() == superTypeName)
return true;
metaObject = metaObject->superClass();
}
return false;
return Internal::QmlPrivateGate::isSubclassOf(object, superTypeName);
}
void ServerNodeInstance::setNodeSource(const QString &source)
@@ -242,8 +225,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
}
}
QQmlEnginePrivate::get(nodeInstanceServer->engine())->cache(object->metaObject());
Internal::QmlPrivateGate::getPropertyCache(object, nodeInstanceServer->engine());
ServerNodeInstance instance(createInstance(object));
@@ -753,6 +753,32 @@ bool isNormalProperty(const PropertyName &propertyName)
} // namespace PropertyChanges
bool isSubclassOf(QObject *object, const QByteArray &superTypeName)
{
if (object == 0)
return false;
const QMetaObject *metaObject = object->metaObject();
while (metaObject) {
QQmlType *qmlType = QQmlMetaType::qmlType(metaObject);
if (qmlType && qmlType->qmlTypeName() == superTypeName) // ignore version numbers
return true;
if (metaObject->className() == superTypeName)
return true;
metaObject = metaObject->superClass();
}
return false;
}
void getPropertyCache(QObject *object, QQmlEngine *engine)
{
QQmlEnginePrivate::get(engine)->cache(object->metaObject());
}
ComponentCompleteDisabler::ComponentCompleteDisabler()
{
DesignerSupport::disableComponentComplete();
@@ -127,6 +127,8 @@ public:
} // namespace PropertyChanges
bool isSubclassOf(QObject *object, const QByteArray &superTypeName);
void getPropertyCache(QObject *object, QQmlEngine *engine);
} // namespace QmlPrivateGate
} // namespace Internal