aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/designer
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2018-10-31 10:33:31 +0100
committerThomas Hartmann <thomas.hartmann@qt.io>2018-11-05 09:16:51 +0000
commitf2244820016f27ac2f7d26c8ba51d806956e4968 (patch)
tree84738e9bba80f4cabf9c0bcc37bcb63e65dae757 /src/quick/designer
parentb340d8bb8886ecb46c8702127ff4dffb727c4f24 (diff)
DesignerSupport: Fix emitComponentCompleteSignalForAttachedProperty
The signal for completed for the attached Component property was no emitted correctly by emitComponentCompleteSignalForAttachedProperty(). I added a test for the correct behaivour. Change-Id: I0ebfc10e512ba5c5e2352a5f5d6be3030b43cbbc Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/quick/designer')
-rw-r--r--src/quick/designer/qquickdesignersupport.cpp15
-rw-r--r--src/quick/designer/qquickdesignersupport_p.h2
2 files changed, 12 insertions, 5 deletions
diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp
index 1851c25a77..70b568800d 100644
--- a/src/quick/designer/qquickdesignersupport.cpp
+++ b/src/quick/designer/qquickdesignersupport.cpp
@@ -383,13 +383,20 @@ void QQuickDesignerSupport::resetAnchor(QQuickItem *item, const QString &name)
}
}
-void QQuickDesignerSupport::emitComponentCompleteSignalForAttachedProperty(QQuickItem *item)
+void QQuickDesignerSupport::emitComponentCompleteSignalForAttachedProperty(QObject *object)
{
- QQmlData *data = QQmlData::get(item);
+ if (!object)
+ return;
+
+ QQmlData *data = QQmlData::get(object);
if (data && data->context) {
QQmlComponentAttached *componentAttached = data->context->componentAttached;
- if (componentAttached) {
- emit componentAttached->completed();
+ while (componentAttached) {
+ if (componentAttached->parent())
+ if (componentAttached->parent() == object)
+ emit componentAttached->completed();
+
+ componentAttached = componentAttached->next;
}
}
}
diff --git a/src/quick/designer/qquickdesignersupport_p.h b/src/quick/designer/qquickdesignersupport_p.h
index 6628e404bd..fc46745e15 100644
--- a/src/quick/designer/qquickdesignersupport_p.h
+++ b/src/quick/designer/qquickdesignersupport_p.h
@@ -126,7 +126,7 @@ public:
static QQuickItem *anchorCenterInTargetItem(QQuickItem *item);
static QPair<QString, QObject*> anchorLineTarget(QQuickItem *item, const QString &name, QQmlContext *context);
static void resetAnchor(QQuickItem *item, const QString &name);
- static void emitComponentCompleteSignalForAttachedProperty(QQuickItem *item);
+ static void emitComponentCompleteSignalForAttachedProperty(QObject *item);
static QList<QObject*> statesForItem(QQuickItem *item);