aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2011-04-18 17:20:49 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-02 13:24:22 +0200
commit813135081a8e22b673d2673fc38884b595ec0d33 (patch)
treed6481d1b049ec8dd6fe1582b10adb540a61f3cf8 /src
parent6494f5c5aaec82cc5bcfd42de559d723edef57b1 (diff)
Introduced a CONFIG option that enables declarative debug services
This replaces the need for applications to explicitly make a call to enable the debug services, and rather does it in declarative.h when the 'declarative_debug' CONFIG option is used. Done-with: Kai Koehne Reviewed-by: Martin Jones Reviewed-by: Michael Brasser (cherry picked from commit 5517cc588c39814530b8bfd957821f55be42acf2) Change-Id: Iacfc5a9b2ca0c2610288cf86f190b4a9950cacd1 Reviewed-on: http://codereview.qt.nokia.com/2436 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarative.h11
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp11
2 files changed, 22 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h
index 4c962f890e..311ecd31ca 100644
--- a/src/declarative/qml/qdeclarative.h
+++ b/src/declarative/qml/qdeclarative.h
@@ -550,6 +550,17 @@ inline int qmlRegisterModuleApi(const char *uri, int versionMajor, int versionMi
return QDeclarativePrivate::qmlregister(QDeclarativePrivate::ModuleApiRegistration, &api);
}
+// Enable debugging before any QDeclarativeEngine is created
+struct Q_DECLARATIVE_EXPORT QDeclarativeDebuggingEnabler
+{
+ QDeclarativeDebuggingEnabler();
+};
+
+// Execute code in constructor before first QDeclarativeEngine is instantiated
+#if defined(QT_DECLARATIVE_DEBUG)
+static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper;
+#endif
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QObject)
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index a2f724e3f8..e62f07c205 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -992,6 +992,17 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+QDeclarativeDebuggingEnabler::QDeclarativeDebuggingEnabler()
+{
+#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL
+ if (!QDeclarativeEnginePrivate::qml_debugging_enabled) {
+ qWarning("Qml debugging is enabled. Only use this in a safe environment!");
+ }
+ QDeclarativeEnginePrivate::qml_debugging_enabled = true;
+#endif
+}
+
+
class QDeclarativeDataExtended {
public:
QDeclarativeDataExtended();