diff options
-rw-r--r-- | mkspecs/features/declarative_debug.prf | 1 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarative.h | 11 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 11 | ||||
-rw-r--r-- | tools/qml/main.cpp | 3 | ||||
-rw-r--r-- | tools/qml/qml.pro | 2 |
5 files changed, 24 insertions, 4 deletions
diff --git a/mkspecs/features/declarative_debug.prf b/mkspecs/features/declarative_debug.prf new file mode 100644 index 0000000..b0248f0 --- /dev/null +++ b/mkspecs/features/declarative_debug.prf @@ -0,0 +1 @@ +contains(QT, declarative):DEFINES += QT_DECLARATIVE_DEBUG 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(); diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 24a4940..3b20996 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -52,7 +52,6 @@ #include <QAtomicInt> #include <QLibraryInfo> #include "qdeclarativetester.h" -#include <private/qdeclarativedebughelper_p.h> QT_USE_NAMESPACE @@ -539,8 +538,6 @@ int main(int argc, char ** argv) QApplication::setGraphicsSystem(QLatin1String("raster")); #endif - QDeclarativeDebugHelper::enableDebugging(); - Application app(argc, argv); app.setApplicationName(QLatin1String("QtQmlViewer")); app.setOrganizationName(QLatin1String("Nokia")); diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 9467b70..cf685a8 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -1,5 +1,5 @@ TEMPLATE = app -CONFIG += qt uic +CONFIG += qt uic declarative_debug DESTDIR = ../../bin include(qml.pri) |