diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-15 08:23:33 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-15 08:23:33 (GMT) |
commit | b9f71669979f7e892e3af3197915bb732ab0f243 (patch) | |
tree | 52abed421dd60c8f41db08e8f2290a8949052cfc /tools/qml | |
parent | 2c9ff8dc79b69b310a568f7457838753abbf2178 (diff) | |
download | Qt-b9f71669979f7e892e3af3197915bb732ab0f243.zip Qt-b9f71669979f7e892e3af3197915bb732ab0f243.tar.gz Qt-b9f71669979f7e892e3af3197915bb732ab0f243.tar.bz2 |
Update examples autotest to use the runtime directly
This improves the test execution time
Diffstat (limited to 'tools/qml')
-rw-r--r-- | tools/qml/qmlruntime.cpp | 28 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h | 5 |
2 files changed, 16 insertions, 17 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 0a0ad9b..53409c1 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -550,6 +550,11 @@ QMenuBar *QDeclarativeViewer::menuBar() const return mb; } +QDeclarativeView *QDeclarativeViewer::view() const +{ + return canvas; +} + void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) { QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu; @@ -888,24 +893,19 @@ void QDeclarativeViewer::addPluginPath(const QString& plugin) void QDeclarativeViewer::reload() { - openQml(currentFileOrUrl); -} - -void QDeclarativeViewer::open(const QString& doc) -{ - openQml(doc); + open(currentFileOrUrl); } void QDeclarativeViewer::openFile() { QString cur = canvas->source().toLocalFile(); if (useQmlFileBrowser) { - openQml("qrc:/content/Browser.qml"); + open("qrc:/content/Browser.qml"); } else { QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)")); if (!fileName.isEmpty()) { QFileInfo fi(fileName); - openQml(fi.absoluteFilePath()); + open(fi.absoluteFilePath()); } } } @@ -935,10 +935,10 @@ void QDeclarativeViewer::statusChanged() void QDeclarativeViewer::launch(const QString& file_or_url) { - QMetaObject::invokeMethod(this, "openQml", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); + QMetaObject::invokeMethod(this, "open", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); } -void QDeclarativeViewer::openQml(const QString& file_or_url) +bool QDeclarativeViewer::open(const QString& file_or_url) { currentFileOrUrl = file_or_url; @@ -971,7 +971,7 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) if (fi.exists()) { if (fi.suffix().toLower() != QLatin1String("qml")) { qWarning() << "qml cannot open non-QML file" << fileName; - return; + return false; } QDir dir(fi.path()+"/dummydata", "*.qml"); @@ -1002,7 +1002,7 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) } } else { qWarning() << "qml cannot find file:" << fileName; - return; + return false; } } @@ -1013,9 +1013,7 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) qWarning() << "Wall startup time:" << t.elapsed(); -#ifdef QTOPIA - show(); -#endif + return true; } void QDeclarativeViewer::startNetwork() diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 8792d0c..2089dda 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -105,10 +105,11 @@ public: QMenuBar *menuBar() const; + QDeclarativeView *view() const; + public slots: void sceneResized(QSize size); - void open(const QString&); - void openQml(const QString&); + bool open(const QString&); void openFile(); void reload(); void takeSnapShot(); |