diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-21 07:23:33 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-21 07:23:33 (GMT) |
commit | 45357546c29240b95300f392084a2fe901073d85 (patch) | |
tree | aca89043c1bd80a3a7515402ee0fbb55b9cbf6ee /examples/script/context2d | |
parent | 2e645960930442e895f887f1ef5e226d14eabcc7 (diff) | |
parent | f11fc8f62558543dac1eca9d52a4801196c55221 (diff) | |
download | Qt-45357546c29240b95300f392084a2fe901073d85.zip Qt-45357546c29240b95300f392084a2fe901073d85.tar.gz Qt-45357546c29240b95300f392084a2fe901073d85.tar.bz2 |
Merge commit 'qt/master'
Conflicts:
configure.exe
examples/examples.pro
qmake/Makefile.unix
qmake/Makefile.win32
qmake/Makefile.win32-g++
qmake/Makefile.win32-g++-sh
qmake/qmake.pro
src/script/api/qscriptable.h
src/script/api/qscriptclasspropertyiterator.h
src/script/api/qscriptcontext.h
src/script/api/qscriptengineagent.cpp
src/script/api/qscriptstring.cpp
src/script/api/qscriptstring.h
src/script/api/qscriptvalueiterator.cpp
src/script/api/qscriptvalueiterator.h
src/script/qscriptclass.cpp
src/script/qscriptcontext.cpp
src/script/qscriptengine.cpp
src/script/qscriptengine_p.cpp
src/script/qscriptvalue.cpp
src/script/qscriptvalue_p.h
src/script/qscriptvalueimplfwd_p.h
src/script/script.pro
src/src.pro
tests/auto/auto.pro
tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
tools/configure/configureapp.cpp
Diffstat (limited to 'examples/script/context2d')
-rw-r--r-- | examples/script/context2d/window.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/examples/script/context2d/window.cpp b/examples/script/context2d/window.cpp index 5d3f4df..d70a4f1 100644 --- a/examples/script/context2d/window.cpp +++ b/examples/script/context2d/window.cpp @@ -66,7 +66,8 @@ static QString scriptsDir() //! [0] Window::Window(QWidget *parent) - : QWidget(parent) + : QWidget(parent), + m_debugger(0), m_debugWindow(0) { m_env = new Environment(this); QObject::connect(m_env, SIGNAL(scriptError(QScriptValue)), @@ -107,14 +108,6 @@ Window::Window(QWidget *parent) this, SLOT(selectScript(QListWidgetItem*))); //! [1] -#ifndef QT_NO_SCRIPTTOOLS - m_debugger = new QScriptEngineDebugger(this); - m_debugger->attachTo(m_env->engine()); - m_debugWindow = m_debugger->standardWindow(); - m_debugWindow->setWindowModality(Qt::ApplicationModal); - m_debugWindow->resize(1280, 704); -#endif - setWindowTitle(tr("Context 2D")); } @@ -156,8 +149,19 @@ void Window::runScript(const QString &fileName, bool debug) m_env->reset(); #ifndef QT_NO_SCRIPTTOOLS - if (debug) + if (debug) { + if (!m_debugger) { + m_debugger = new QScriptEngineDebugger(this); + m_debugWindow = m_debugger->standardWindow(); + m_debugWindow->setWindowModality(Qt::ApplicationModal); + m_debugWindow->resize(1280, 704); + } + m_debugger->attachTo(m_env->engine()); m_debugger->action(QScriptEngineDebugger::InterruptAction)->trigger(); + } else { + if (m_debugger) + m_debugger->detach(); + } #else Q_UNUSED(debug); #endif @@ -165,7 +169,8 @@ void Window::runScript(const QString &fileName, bool debug) QScriptValue ret = m_env->evaluate(contents, fileName); #ifndef QT_NO_SCRIPTTOOLS - m_debugWindow->hide(); + if (m_debugWindow) + m_debugWindow->hide(); #endif if (ret.isError()) |