aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2018-10-18 15:45:04 +0200
committerTim Jenssen <tim.jenssen@qt.io>2018-10-18 14:41:57 +0000
commit7bff611ee18d3b68140f0f52fc0f7ff9284ca26f (patch)
tree0bcc2a42c06584b782b633e04221cf34299d8d80 /share/qtcreator
parent673a11570338420fb6340556059148467b0738bd (diff)
QmlDesigner: Call all Component complete handlers
We have to ensure to properly call all Component complete handlers. A single component usually has QQmlComponentAttached objects, which we have to iterate over. Therefore emitComponentCompleteSignalForAttachedProperty() is not correct. Task-number: QDS-269 Change-Id: I4aed5d511f9f6e21f72efb955fc6db21b70e7c42 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'share/qtcreator')
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h1
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp22
3 files changed, 24 insertions, 1 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
index 1652e0f61a..761ad9cdfe 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
@@ -195,7 +195,7 @@ void QuickItemNodeInstance::doComponentComplete()
QmlPrivateGate::disableTextCursor(quickItem());
- DesignerSupport::emitComponentCompleteSignalForAttachedProperty(quickItem());
+ QmlPrivateGate::emitComponentComplete(quickItem());
QQmlProperty contentItemProperty(quickItem(), "contentItem", engine());
if (contentItemProperty.isValid())
diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h
index f1066b3d5b..4e90bad1fc 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h
+++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate.h
@@ -85,6 +85,7 @@ public:
void setPropertyBinding(QObject *object, QQmlContext *context, const PropertyName &propertyName, const QString &expression);
void keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const PropertyName &propertyName);
+ void emitComponentComplete(QObject *item);
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
bool objectWasDeleted(QObject *object);
diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp
index 5e7818e3d6..d41323e310 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp
@@ -44,6 +44,8 @@
#include <private/qquickdesignersupportproperties_p.h>
#include <private/qquickdesignersupportpropertychanges_p.h>
#include <private/qquickdesignersupportstates_p.h>
+#include <private/qqmldata_p.h>
+#include <private/qqmlcomponentattached_p.h>
namespace QmlDesigner {
@@ -216,6 +218,24 @@ void setPropertyBinding(QObject *object, QQmlContext *context, const PropertyNam
QQuickDesignerSupportProperties::setPropertyBinding(object, context, propertyName, expression);
}
+void emitComponentComplete(QObject *item)
+{
+ if (!item)
+ return;
+
+ QQmlData *data = QQmlData::get(item);
+ if (data && data->context) {
+ QQmlComponentAttached *componentAttached = data->context->componentAttached;
+ while (componentAttached) {
+ if (componentAttached->parent())
+ if (componentAttached->parent() == item)
+ emit componentAttached->completed();
+
+ componentAttached = componentAttached->next;
+ }
+ }
+}
+
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer)
{
if (object) {
@@ -224,6 +244,8 @@ void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInsta
if (item && DesignerSupport::isComponentComplete(item))
return;
+ if (!nodeInstanceServer->hasInstanceForObject(item))
+ emitComponentComplete(object);
QList<QObject*> childList = object->children();
if (item) {