QmlApp template: Use new 4.7.1 API to enable qml debugging

Qml debugging is now disabled by default, and has to be enabled
explicitly (b2016bbfc9). This has to be done before the
QDView/QDEngine is instantiated ...

The patch introduces a static create method to QmlApplicationViewer,
so that the setup can be hidden from the users main file.

Reviewed-by: Alessandro Portale
This commit is contained in:
Kai Koehne
2010-11-03 10:44:40 +01:00
parent 0a03f8325e
commit 2ac91abd30
4 changed files with 26 additions and 2 deletions

View File

@@ -59,6 +59,10 @@ class QMLJSDEBUGGER_EXTERN QDeclarativeDebugHelper
public: public:
static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine);
static void setAnimationSlowDownFactor(qreal factor); static void setAnimationSlowDownFactor(qreal factor);
// Enables remote debugging functionality
// Only use this for debugging in a safe environment!
static void enableDebugging();
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@@ -20,7 +20,7 @@ DEFINES += NETWORKACCESS
# TARGETUID3 # # TARGETUID3 #
symbian:TARGET.UID3 = 0xE1111234 symbian:TARGET.UID3 = 0xE1111234
# Define QMLJSDEBUGGER to allow debugging of QML # Define QMLJSDEBUGGER to allow debugging of QML in debug builds
# (This might significantly increase build time) # (This might significantly increase build time)
# DEFINES += QMLJSDEBUGGER # DEFINES += QMLJSDEBUGGER

View File

@@ -16,6 +16,10 @@
#include <QtDeclarative/QDeclarativeEngine> #include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext> #include <QtDeclarative/QDeclarativeContext>
#if defined(QMLJSDEBUGGER)
#include <qt_private/qdeclarativedebughelper_p.h>
#endif
#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) #if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER)
#include <jsdebuggeragent.h> #include <jsdebuggeragent.h>
#endif #endif
@@ -30,6 +34,22 @@
#include <aknappui.h> #include <aknappui.h>
#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK
#if defined(QMLJSDEBUGGER)
// Enable debugging before any QDeclarativeEngine is created
struct QmlJsDebuggingEnabler
{
QmlJsDebuggingEnabler()
{
QDeclarativeDebugHelper::enableDebugging();
}
};
// Execute code in constructor before first QDeclarativeEngine is instantiated
static QmlJsDebuggingEnabler enableDebuggingHelper;
#endif // QMLJSDEBUGGER
class QmlApplicationViewerPrivate class QmlApplicationViewerPrivate
{ {
QString mainQmlFile; QString mainQmlFile;

View File

@@ -477,7 +477,7 @@ bool QmlStandaloneApp::updateFiles(const QList<QmlAppGeneratedFileInfo> &list, Q
return true; return true;
} }
const int QmlStandaloneApp::StubVersion = 9; const int QmlStandaloneApp::StubVersion = 10;
} // namespace Internal } // namespace Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager