diff options
-rw-r--r-- | src/declarative/qml/qdeclarative.h | 11 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 11 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 2 | ||||
-rw-r--r-- | tools/qmlscene/qmlscene.pro | 2 | ||||
-rw-r--r-- | tools/qmlviewer/main.cpp | 3 | ||||
-rw-r--r-- | tools/qmlviewer/qmlviewer.pro | 2 |
6 files changed, 24 insertions, 7 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(); diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 0d6f813a8e..e6603adbd8 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -56,7 +56,6 @@ #include <QtGui/QGraphicsView> #include <QtDeclarative/qdeclarativecontext.h> -#include <private/qdeclarativedebughelper_p.h> // ### This should be private API #include <qsgitem.h> @@ -455,7 +454,6 @@ int main(int argc, char ** argv) Options options; - QDeclarativeDebugHelper::enableDebugging(); QStringList imports; for (int i = 1; i < argc; ++i) { if (*argv[i] != '-' && QFileInfo(argv[i]).exists()) diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro index 8e252e589f..7a722630e0 100644 --- a/tools/qmlscene/qmlscene.pro +++ b/tools/qmlscene/qmlscene.pro @@ -11,7 +11,7 @@ macx: CONFIG -= app_bundle SOURCES += main.cpp -CONFIG += console +CONFIG += console declarative_debug symbian { TARGET.EPOCHEAPSIZE = 0x20000 0x5000000 diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index bf99fa5630..cf33c4e365 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/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/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro index 16579bb167..991d07c5a4 100644 --- a/tools/qmlviewer/qmlviewer.pro +++ b/tools/qmlviewer/qmlviewer.pro @@ -1,5 +1,5 @@ TEMPLATE = app -CONFIG += qt uic +CONFIG += qt uic declarative_debug DESTDIR = ../../bin QT += declarative qtquick1 qtquick1-private |