summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-21 07:23:33 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-21 07:23:33 (GMT)
commit45357546c29240b95300f392084a2fe901073d85 (patch)
treeaca89043c1bd80a3a7515402ee0fbb55b9cbf6ee /examples
parent2e645960930442e895f887f1ef5e226d14eabcc7 (diff)
parentf11fc8f62558543dac1eca9d52a4801196c55221 (diff)
downloadQt-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')
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/script/calculator/main.cpp4
-rw-r--r--examples/script/context2d/window.cpp27
-rw-r--r--examples/script/qstetrix/main.cpp4
4 files changed, 21 insertions, 16 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
index dc407e7..4aa5576 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -22,7 +22,6 @@ SUBDIRS = \
widgets \
uitools \
xml \
- script \
multitouch \
gestures
@@ -39,6 +38,7 @@ symbian: SUBDIRS = \
uitools \
xml
+contains(QT_CONFIG, script): SUBDIRS += script
contains(QT_CONFIG, multimedia):!static: SUBDIRS += multimedia
contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon
contains(QT_CONFIG, webkit): SUBDIRS += webkit
diff --git a/examples/script/calculator/main.cpp b/examples/script/calculator/main.cpp
index d85d0ae..2930a97 100644
--- a/examples/script/calculator/main.cpp
+++ b/examples/script/calculator/main.cpp
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
QScriptEngine engine;
//! [0a]
-#ifndef QT_NO_SCRIPTTOOLS
+#if !defined(QT_NO_SCRIPTTOOLS)
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
QMainWindow *debugWindow = debugger.standardWindow();
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
QScriptValue calc = ctor.construct(QScriptValueList() << scriptUi);
//! [2]
-#ifndef QT_NO_SCRIPTTOOLS
+#if !defined(QT_NO_SCRIPTTOOLS)
QLineEdit *display = qFindChild<QLineEdit*>(ui, "display");
QObject::connect(display, SIGNAL(returnPressed()),
debugWindow, SLOT(show()));
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())
diff --git a/examples/script/qstetrix/main.cpp b/examples/script/qstetrix/main.cpp
index 52cf76f..8e83c7a 100644
--- a/examples/script/qstetrix/main.cpp
+++ b/examples/script/qstetrix/main.cpp
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
engine.globalObject().setProperty("Qt", Qt);
//! [1]
-#ifndef QT_NO_SCRIPTTOOLS
+#if !defined(QT_NO_SCRIPTTOOLS)
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
QMainWindow *debugWindow = debugger.standardWindow();
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
//! [3]
QPushButton *debugButton = qFindChild<QPushButton*>(ui, "debugButton");
-#ifndef QT_NO_SCRIPTTOOLS
+#if !defined(QT_NO_SCRIPTTOOLS)
QObject::connect(debugButton, SIGNAL(clicked()),
debugger.action(QScriptEngineDebugger::InterruptAction),
SIGNAL(triggered()));