forked from qt-creator/qt-creator
QmlPuppet: Move doComponentCompleteRecursive to QmlPrivateGate
Change-Id: Ib6ccf791e1dd74878e04c8248bed371fb08084cf Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -425,7 +425,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
|
||||
nodeInstanceServer()->removeFilePropertyFromFileSystemWatcher(object(), name, path);
|
||||
}
|
||||
|
||||
if (hasValidResetBinding(name)) {
|
||||
if (hasValidResetBinding(name)) { //####
|
||||
QQmlPropertyPrivate::setBinding(property, 0, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
|
||||
}
|
||||
|
||||
@@ -852,38 +852,6 @@ QObject *ObjectNodeInstance::parentObject(QObject *object)
|
||||
return object->parent();
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer)
|
||||
{
|
||||
if (object) {
|
||||
QQuickItem *item = qobject_cast<QQuickItem*>(object);
|
||||
|
||||
if (item && DesignerSupport::isComponentComplete(item))
|
||||
return;
|
||||
|
||||
QList<QObject*> childList = object->children();
|
||||
|
||||
if (item) {
|
||||
foreach (QQuickItem *childItem, item->childItems()) {
|
||||
if (!childList.contains(childItem))
|
||||
childList.append(childItem);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QObject *child, childList) {
|
||||
if (!nodeInstanceServer->hasInstanceForObject(child))
|
||||
doComponentCompleteRecursive(child, nodeInstanceServer);
|
||||
}
|
||||
|
||||
if (item) {
|
||||
static_cast<QQmlParserStatus*>(item)->componentComplete();
|
||||
} else {
|
||||
QQmlParserStatus *qmlParserStatus = dynamic_cast< QQmlParserStatus*>(object);
|
||||
if (qmlParserStatus)
|
||||
qmlParserStatus->componentComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ObjectNodeInstance::Pointer ObjectNodeInstance::parentInstance() const
|
||||
{
|
||||
QObject *parentHolder = parent();
|
||||
@@ -942,7 +910,7 @@ bool ObjectNodeInstance::resetStateProperty(const ObjectNodeInstance::Pointer &/
|
||||
|
||||
void ObjectNodeInstance::doComponentComplete()
|
||||
{
|
||||
doComponentCompleteRecursive(object(), nodeInstanceServer());
|
||||
QmlPrivateGate::doComponentCompleteRecursive(object(), nodeInstanceServer());
|
||||
}
|
||||
|
||||
bool ObjectNodeInstance::isRootNodeInstance() const
|
||||
|
@@ -194,7 +194,6 @@ protected:
|
||||
QVariant convertSpecialCharacter(const QVariant& value) const;
|
||||
QVariant convertEnumToValue(const QVariant &value, const PropertyName &name);
|
||||
static QObject *parentObject(QObject *object);
|
||||
static void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
|
||||
static QVariant enumationValue(const Enumeration &enumeration);
|
||||
|
||||
private:
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "designercustomobjectdata.h"
|
||||
|
||||
#include <objectnodeinstance.h>
|
||||
#include <nodeinstanceserver.h>
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QQmlComponent>
|
||||
@@ -472,6 +473,38 @@ bool hasBindingForProperty(QObject *object, const PropertyName &propertyName, bo
|
||||
return DesignerCustomObjectData::hasBindingForProperty(object, propertyName, hasChanged);
|
||||
}
|
||||
|
||||
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer)
|
||||
{
|
||||
if (object) {
|
||||
QQuickItem *item = qobject_cast<QQuickItem*>(object);
|
||||
|
||||
if (item && DesignerSupport::isComponentComplete(item))
|
||||
return;
|
||||
|
||||
QList<QObject*> childList = object->children();
|
||||
|
||||
if (item) {
|
||||
foreach (QQuickItem *childItem, item->childItems()) {
|
||||
if (!childList.contains(childItem))
|
||||
childList.append(childItem);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QObject *child, childList) {
|
||||
if (!nodeInstanceServer->hasInstanceForObject(child))
|
||||
doComponentCompleteRecursive(child, nodeInstanceServer);
|
||||
}
|
||||
|
||||
if (item) {
|
||||
static_cast<QQmlParserStatus*>(item)->componentComplete();
|
||||
} else {
|
||||
QQmlParserStatus *qmlParserStatus = dynamic_cast< QQmlParserStatus*>(object);
|
||||
if (qmlParserStatus)
|
||||
qmlParserStatus->componentComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComponentCompleteDisabler::ComponentCompleteDisabler()
|
||||
{
|
||||
DesignerSupport::disableComponentComplete();
|
||||
|
@@ -40,6 +40,9 @@
|
||||
#include <QQmlListReference>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class NodeInstanceServer;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ObjectNodeInstance;
|
||||
@@ -85,6 +88,8 @@ public:
|
||||
bool hasValidResetBinding(QObject *object, const PropertyName &propertyName);
|
||||
bool hasBindingForProperty(QObject *object, const PropertyName &propertyName, bool *hasChanged);
|
||||
|
||||
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
|
||||
|
||||
} // namespace QmlPrivateGate
|
||||
} // namespace Internal
|
||||
} // namespace QmlDesigner
|
||||
|
Reference in New Issue
Block a user