summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-30 09:14:43 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-30 09:14:43 (GMT)
commit81542982a9b7f4d55707ec6abfd26f5046871f88 (patch)
tree56b023bea089c960cec64483cf6d62304aa274f4
parent126ab609611d188322eeaeca38ecc9ae13e9574b (diff)
parentbd2ba54d85415047a581b7b441309572a756dcc5 (diff)
downloadQt-81542982a9b7f4d55707ec6abfd26f5046871f88.zip
Qt-81542982a9b7f4d55707ec6abfd26f5046871f88.tar.gz
Qt-81542982a9b7f4d55707ec6abfd26f5046871f88.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--src/declarative/qml/qmlengine.cpp14
-rw-r--r--src/declarative/qml/qmlengine.h3
-rw-r--r--src/declarative/qml/qmlengine_p.h3
-rw-r--r--src/declarative/util/qmlview.cpp1
-rw-r--r--src/declarative/util/qmlview.h1
-rw-r--r--tools/qmlviewer/qmlviewer.cpp1
6 files changed, 23 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index c0692eb..864d07e 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -147,6 +147,7 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
qtObject.setProperty(QLatin1String("md5"),scriptEngine.newFunction(md5, 1));
qtObject.setProperty(QLatin1String("btoa"),scriptEngine.newFunction(btoa, 1));
qtObject.setProperty(QLatin1String("atob"),scriptEngine.newFunction(atob, 1));
+ qtObject.setProperty(QLatin1String("quit"), scriptEngine.newFunction(QmlEnginePrivate::quit, 0));
//firebug/webkit compat
QScriptValue consoleObject = scriptEngine.newObject();
@@ -868,6 +869,19 @@ QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e
return e->newVariant(QVariant(true));
}
+void QmlEnginePrivate::sendQuit ()
+{
+ Q_Q(QmlEngine);
+ emit q->quit ();
+}
+
+QScriptValue QmlEnginePrivate::quit(QScriptContext *ctxt, QScriptEngine *e)
+{
+ QmlEnginePrivate *qe = get (e);
+ qe->sendQuit ();
+ return QScriptValue();
+}
+
QScriptValue QmlEnginePrivate::closestAngle(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 2)
diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h
index 0b18e94..7cbbcac 100644
--- a/src/declarative/qml/qmlengine.h
+++ b/src/declarative/qml/qmlengine.h
@@ -89,6 +89,9 @@ public:
static QmlContext *contextForObject(const QObject *);
static void setContextForObject(QObject *, QmlContext *);
+Q_SIGNALS:
+ void quit ();
+
private:
Q_DECLARE_PRIVATE(QmlEngine)
};
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index 191be83..9e0c1fc 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -254,6 +254,8 @@ public:
QScriptValue scriptValueFromVariant(const QVariant &);
QVariant scriptValueToVariant(const QScriptValue &);
+ void sendQuit ();
+
static QScriptValue qmlScriptObject(QObject*, QmlEngine*);
static QScriptValue createComponent(QScriptContext*, QScriptEngine*);
@@ -276,6 +278,7 @@ public:
static QScriptValue btoa(QScriptContext*, QScriptEngine*);
static QScriptValue atob(QScriptContext*, QScriptEngine*);
static QScriptValue consoleLog(QScriptContext*, QScriptEngine*);
+ static QScriptValue quit(QScriptContext*, QScriptEngine*);
static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; }
static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); }
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp
index 62bcc07..afeead2 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -291,6 +291,7 @@ void QmlView::execute()
} else {
d->component = new QmlComponent(&d->engine, d->qml.toUtf8(), d->source, this);
}
+ connect (&d->engine, SIGNAL (quit ()), this, SIGNAL (quit ()));
if (!d->component->isLoading()) {
continueExecute();
diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h
index 83c4f97..f4f58fd 100644
--- a/src/declarative/util/qmlview.h
+++ b/src/declarative/util/qmlview.h
@@ -90,6 +90,7 @@ Q_SIGNALS:
void initialSize(QSize size);
void sceneResized(QSize size);
void errors(const QList<QmlError> &error);
+ void quit ();
private Q_SLOTS:
void continueExecute();
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 13f0009..a354653 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -341,6 +341,7 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags)
QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
QObject::connect(canvas, SIGNAL(initialSize(QSize)), this, SLOT(adjustSizeSlot()));
QObject::connect(canvas, SIGNAL(errors(QList<QmlError>)), this, SLOT(executeErrors()));
+ QObject::connect(canvas, SIGNAL(quit()), QCoreApplication::instance (), SLOT(quit()));
if (!(flags & Qt::FramelessWindowHint)) {
createMenu(menuBar(),0);