diff options
-rw-r--r-- | src/scripttools/debugging/qscriptenginedebugger.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index ae58c89..f2245cc 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -126,7 +126,7 @@ public: mode in which it accepts input from the user. The evaluationResumed() signal is emitted when script evaluation is resumed, i.e, when execution control is given back to the script - engine. + engine. The state() function returns the debugger's current state. When calling QScriptEngine::evaluate() it is useful to pass a descriptive script name (file name) as second argument, as this is @@ -228,6 +228,7 @@ public: /*! \enum QScriptEngineDebugger::DebuggerState + \since 4.6 This enum specifies the current state of the debugger. @@ -396,6 +397,8 @@ void QScriptEngineDebugger::detach() } /*! + \since 4.6 + Returns the current state of the debugger. \sa evaluationResumed() @@ -404,7 +407,7 @@ void QScriptEngineDebugger::detach() QScriptEngineDebugger::DebuggerState QScriptEngineDebugger::state() const { Q_D(const QScriptEngineDebugger); - return (d->debugger && d->debugger->isInteractive() ? SuspendedState : RunningState); + return !d->debugger || !d->debugger->isInteractive() ? SuspendedState : RunningState; } /*! diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp index 5d9f56f..7f3f9f3 100644 --- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp +++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp @@ -111,9 +111,11 @@ void tst_QScriptEngineDebugger::attachAndDetach() { { QScriptEngineDebugger debugger; + QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState); debugger.attachTo(0); QScriptEngine engine; debugger.attachTo(&engine); + QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState); } { QScriptEngineDebugger debugger; |