From 1a1ce4326c55f0af9acb3d3b42d70040bbe45673 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 9 Apr 2013 12:54:09 +0200 Subject: [PATCH] DesignerSupport: Adding separate flag for component completion The designer should only disable completion of components if the component is created directly by the designer. Change-Id: Id86d2b2f2e61355240bdbbb7875db3e97fb0da17 Reviewed-by: Marco Bubke --- src/qml/qml/qqmlvme.cpp | 19 ++++++++++++++++++- src/qml/qml/qqmlvme_p.h | 6 ++++++ src/quick/designer/designersupport.cpp | 10 ++++++++++ src/quick/designer/designersupport.h | 3 +++ 4 files changed, 37 insertions(+), 1 deletions(-) diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 8198eec..c34b922 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -91,6 +91,8 @@ using namespace QQmlVMETypes; goto exceptionExit; \ } +bool QQmlVME::s_enableComponentComplete = true; + void QQmlVME::init(QQmlContextData *ctxt, QQmlCompiledData *comp, int start, QQmlContextData *creation) { @@ -1326,7 +1328,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) bindValues.deallocate(); } - if (!QQmlEnginePrivate::designerMode()) { // the qml designer does the component complete later + if (componentCompleteEnabled()) { // the qml designer does the component complete later QQmlTrace trace("VME Component Complete"); while (!parserStatus.isEmpty()) { QQmlParserStatus *status = parserStatus.pop(); @@ -1390,6 +1392,21 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) return rv; } +void QQmlVME::enableComponentComplete() +{ + s_enableComponentComplete = true; +} + +void QQmlVME::disableComponentComplete() +{ + s_enableComponentComplete = false; +} + +bool QQmlVME::componentCompleteEnabled() +{ + return s_enableComponentComplete; +} + void QQmlVME::blank(QFiniteStack &bs) { for (int ii = 0; ii < bs.count(); ++ii) { diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h index 62ba47f..405a83c 100644 --- a/src/qml/qml/qqmlvme_p.h +++ b/src/qml/qml/qqmlvme_p.h @@ -140,6 +140,10 @@ public: QObject *execute(QList *errors, const Interrupt & = Interrupt()); QQmlContextData *complete(const Interrupt & = Interrupt()); + static void enableComponentComplete(); + static void disableComponentComplete(); + static bool componentCompleteEnabled(); + private: friend class QQmlVMEGuard; @@ -179,6 +183,8 @@ private: static void blank(QFiniteStack &); static void blank(QFiniteStack &); + + static bool s_enableComponentComplete; }; // Used to check that a QQmlVME that is interrupted mid-execution diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp index 7f75857..063fa6e 100644 --- a/src/quick/designer/designersupport.cpp +++ b/src/quick/designer/designersupport.cpp @@ -437,6 +437,16 @@ void DesignerSupport::activateDesignerMode() QQmlEnginePrivate::activateDesignerMode(); } +void DesignerSupport::disableComponentComplete() +{ + QQmlVME::disableComponentComplete(); +} + +void DesignerSupport::enableComponentComplete() +{ + QQmlVME::enableComponentComplete(); +} + void DesignerSupport::createOpenGLContext(QQuickWindow *window) { DesignerWindowManager::createOpenGLContext(window); diff --git a/src/quick/designer/designersupport.h b/src/quick/designer/designersupport.h index c93cffa..4567e5c 100644 --- a/src/quick/designer/designersupport.h +++ b/src/quick/designer/designersupport.h @@ -145,6 +145,9 @@ public: static void activateDesignerWindowManager(); static void activateDesignerMode(); + static void disableComponentComplete(); + static void enableComponentComplete(); + static void createOpenGLContext(QQuickWindow *window); static void polishItems(QQuickWindow *window); -- 1.7.2.5