aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/designer
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2013-04-23 09:25:29 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-23 12:53:48 +0200
commit88e215b6d56b406d994f97a0adbd2a6afff655be (patch)
tree796d4036a5b32eb72c39b14ff83c320a41d99ec4 /src/quick/designer
parent7167ebd3012147b41a447a6b0bbecc64b6017bd4 (diff)
Adding emitComponentCompleteSignalForAttachedProperty()
Each item that is created by a component gets the attached property "Component". This property has the signal onCompleted. This function allows the designer to manually emit this signal once the item is setup. I had to export QQmlComponentAttached for this. Change-Id: I45b4e72af4f12cdcda29f165cc9bc4d9dee8faf7 Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Diffstat (limited to 'src/quick/designer')
-rw-r--r--src/quick/designer/designersupport.cpp13
-rw-r--r--src/quick/designer/designersupport.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp
index 063fa6ebb1..2dd041b968 100644
--- a/src/quick/designer/designersupport.cpp
+++ b/src/quick/designer/designersupport.cpp
@@ -51,6 +51,8 @@
#include <QtQuick/private/qquickstategroup_p.h>
#include <QtGui/QImage>
#include <private/qqmlvme_p.h>
+#include <private/qqmlcomponentattached_p.h>
+#include <private/qqmldata_p.h>
#include "designerwindowmanager_p.h"
@@ -375,6 +377,17 @@ void DesignerSupport::resetAnchor(QQuickItem *item, const QString &name)
}
}
+void DesignerSupport::emitComponentCompleteSignalForAttachedProperty(QQuickItem *item)
+{
+ QQmlData *data = QQmlData::get(item);
+ if (data && data->context) {
+ QQmlComponentAttached *componentAttached = data->context->componentAttached;
+ if (componentAttached) {
+ emit componentAttached->completed();
+ }
+ }
+}
+
QList<QObject*> DesignerSupport::statesForItem(QQuickItem *item)
{
QList<QObject*> objectList;
diff --git a/src/quick/designer/designersupport.h b/src/quick/designer/designersupport.h
index 4567e5c3d8..5139a65645 100644
--- a/src/quick/designer/designersupport.h
+++ b/src/quick/designer/designersupport.h
@@ -125,6 +125,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 QList<QObject*> statesForItem(QQuickItem *item);