summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2011-04-18 15:20:49 (GMT)
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2011-05-04 13:48:46 (GMT)
commit5517cc588c39814530b8bfd957821f55be42acf2 (patch)
treebc90711b251831aacc75764f528560ccf48e9f7a /src
parent35faeb205843c4f0b921d2b878d2d24962c64664 (diff)
downloadQt-5517cc588c39814530b8bfd957821f55be42acf2.zip
Qt-5517cc588c39814530b8bfd957821f55be42acf2.tar.gz
Qt-5517cc588c39814530b8bfd957821f55be42acf2.tar.bz2
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 Change-Id: I817f22a4ec9226a1ee2d080c1f5bb75d8599a06e Reviewed-by: Martin Jones Reviewed-by: Michael Brasser
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 5da7901..28a6be4 100644
--- a/src/declarative/qml/qdeclarative.h
+++ b/src/declarative/qml/qdeclarative.h
@@ -405,6 +405,17 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create);
}
+// 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 fb3e136..2841b15 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1088,6 +1088,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();