From ffdbf216dc80b3d781307bb6b4b7150281c874a3 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 27 Mar 2012 09:20:20 +0200 Subject: [PATCH] Debugger: Allow enabling of qml debugger without startup warning Add QT_DECLARATIVE_DEBUG_NO_WARNING define to support enabling the qml debugger without printing the usual startup warning. This should be used with care, but e.g. for qmlscene the warning probably confuses more than it helps. Change-Id: I33704857baebfc8bca60abbff09138e259390b49 Reviewed-by: Aurindam Jana --- src/qml/debugger/qqmldebug.h | 8 +++++--- src/qml/qml/qqmlengine.cpp | 5 +++-- tools/qmlscene/qmlscene.pro | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/qml/debugger/qqmldebug.h b/src/qml/debugger/qqmldebug.h index 8036032..318e0bd 100644 --- a/src/qml/debugger/qqmldebug.h +++ b/src/qml/debugger/qqmldebug.h @@ -51,12 +51,14 @@ QT_BEGIN_NAMESPACE struct Q_QML_EXPORT QQmlDebuggingEnabler { - QQmlDebuggingEnabler(); + QQmlDebuggingEnabler(bool printWarning = true); }; // Execute code in constructor before first QQmlEngine is instantiated -#if defined(QT_DECLARATIVE_DEBUG) -static QQmlDebuggingEnabler qmlEnableDebuggingHelper; +#if defined(QT_DECLARATIVE_DEBUG_NO_WARNING) +static QQmlDebuggingEnabler qmlEnableDebuggingHelper(false); +#elif defined(QT_DECLARATIVE_DEBUG) +static QQmlDebuggingEnabler qmlEnableDebuggingHelper(true); #endif QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index ec72804..c788a61 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1035,10 +1035,11 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object, return qmlAttachedPropertiesObjectById(*idCache, object, create); } -QQmlDebuggingEnabler::QQmlDebuggingEnabler() +QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning) { #ifndef QQML_NO_DEBUG_PROTOCOL - if (!QQmlEnginePrivate::qml_debugging_enabled) { + if (!QQmlEnginePrivate::qml_debugging_enabled + && printWarning) { qDebug("QML debugging is enabled. Only use this in a safe environment."); } QQmlEnginePrivate::qml_debugging_enabled = true; diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro index 392e607..3e63bd7 100644 --- a/tools/qmlscene/qmlscene.pro +++ b/tools/qmlscene/qmlscene.pro @@ -12,6 +12,6 @@ macx: CONFIG -= app_bundle SOURCES += main.cpp -CONFIG += console declarative_debug +CONFIG += console -DEFINES += QML_RUNTIME_TESTING +DEFINES += QML_RUNTIME_TESTING QT_DECLARATIVE_DEBUG_NO_WARNING -- 2.7.4