diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-02 05:01:15 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-02 05:01:15 (GMT) |
commit | 17035bd496d35364ff7f49ef9cc86b0a8c48fe1e (patch) | |
tree | 63aad9b94698e59cb17ab2179a441d5a45d37d00 /examples/declarative | |
parent | f2cb650fd28d8bb67666de409f26807a2cf1d852 (diff) | |
download | Qt-17035bd496d35364ff7f49ef9cc86b0a8c48fe1e.zip Qt-17035bd496d35364ff7f49ef9cc86b0a8c48fe1e.tar.gz Qt-17035bd496d35364ff7f49ef9cc86b0a8c48fe1e.tar.bz2 |
When loading QML, reset the Browser view.
Diffstat (limited to 'examples/declarative')
-rw-r--r-- | examples/declarative/loader/main.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/examples/declarative/loader/main.cpp b/examples/declarative/loader/main.cpp index 4e6cb23..22e3646 100644 --- a/examples/declarative/loader/main.cpp +++ b/examples/declarative/loader/main.cpp @@ -131,9 +131,19 @@ public: Q_INVOKABLE void launch(const QString &fileName) { - QUrl url(fileName); + m_fileName = fileName; + QMetaObject::invokeMethod(this, "doLaunch", Qt::QueuedConnection); + } + +private slots: + void doLaunch() + { + qDebug() << "dolaunch"; + QUrl url(m_fileName); QFileInfo fi(url.toLocalFile()); if (fi.exists()) { + canvas->reset(); + url = QUrl::fromLocalFile(fi.absoluteFilePath()); QmlContext *ctxt = canvas->rootContext(); QDir dir(fi.path()+"/dummydata", "*.qml"); @@ -160,14 +170,17 @@ public: dummyData->setParent(this); } } - } - canvas->setUrl(url); - canvas->execute(); + canvas->setUrl(url); + canvas->execute(); + } } signals: void logUpdated(); + +private: + QString m_fileName; }; class MainWindow : public QMainWindow |