diff options
author | Kevin Krammer <kevin.krammer.qnx@kdab.com> | 2012-10-12 04:25:23 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2012-10-15 21:07:01 +0200 |
commit | 2910233e521c87a936eaababe90fffd66a840413 (patch) | |
tree | bb50543cc8eb43ea6d1edf386efbe3a28abf56a1 /share | |
parent | 62b400cde7cc3d7abdb3f66df5c55bb4f6ccdcbd (diff) | |
download | qt-creator-2910233e521c87a936eaababe90fffd66a840413.tar.gz |
QNX: use QmlApplicationViewer provided by main QtQuick template
Reuse the QML application class provided by the standard QtQuick1
template.
Extends qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp with
code paths for Q_OS_QNX
Change-Id: I04a283078299f662d630d9387cedc65100f545a0
Reviewed-by: Mehdi Fekari <mfekari@rim.com>
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
Diffstat (limited to 'share')
4 files changed, 17 insertions, 15 deletions
diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp index 79c9fe0deb..f422178079 100644 --- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -61,6 +61,9 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("%1/../Resources/%2") .arg(QCoreApplication::applicationDirPath(), path); +#elif defined(Q_OS_QNX) + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("app/native/%1").arg(path); #elif !defined(Q_OS_ANDROID) const QString pathInInstallDir = QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); @@ -154,7 +157,7 @@ void QmlApplicationViewer::showExpanded() { #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) showFullScreen(); -#elif defined(Q_WS_MAEMO_5) +#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) showMaximized(); #else show(); diff --git a/share/qtcreator/templates/wizards/bb-quickapp/main.cpp b/share/qtcreator/templates/wizards/bb-quickapp/main.cpp index 0567683b62..618da57ec9 100644 --- a/share/qtcreator/templates/wizards/bb-quickapp/main.cpp +++ b/share/qtcreator/templates/wizards/bb-quickapp/main.cpp @@ -1,20 +1,15 @@ #include <QApplication> -#include <QDeclarativeView> -#include <QObject> +#include "qmlapplicationviewer.h" int main(int argc, char *argv[]) { - QApplication a(argc, argv); + QScopedPointer<QApplication> app(createApplication(argc, argv)); - QDeclarativeView view; -#ifdef Q_OS_QNX - view.setSource(QUrl("app/native/qml/main.qml")); -#else - view.setSource(QUrl("qml/main.qml")); -#endif - view.setAttribute(Qt::WA_AutoOrientation, true); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - view.showMaximized(); + QmlApplicationViewer viewer; + viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION + viewer.setMainQmlFile(QLatin1String("qml/main.qml")); // MAINQML + viewer.showExpanded(); - return a.exec(); + return app->exec(); } diff --git a/share/qtcreator/templates/wizards/bb-quickapp/project.pro b/share/qtcreator/templates/wizards/bb-quickapp/project.pro index 637b8046f4..e2c68d149c 100644 --- a/share/qtcreator/templates/wizards/bb-quickapp/project.pro +++ b/share/qtcreator/templates/wizards/bb-quickapp/project.pro @@ -1,6 +1,7 @@ TEMPLATE = app -QT += declarative +# Please do not modify the following line. +include(qmlapplicationviewer/qmlapplicationviewer.pri) # Additional import path used to resolve QML modules in Creator's code model QML_IMPORT_PATH = diff --git a/share/qtcreator/templates/wizards/bb-quickapp/wizard.xml b/share/qtcreator/templates/wizards/bb-quickapp/wizard.xml index 08940d60cf..3bbbaaa6b2 100644 --- a/share/qtcreator/templates/wizards/bb-quickapp/wizard.xml +++ b/share/qtcreator/templates/wizards/bb-quickapp/wizard.xml @@ -42,5 +42,8 @@ <file source="qml/main.qml" openeditor="true"/> <file source="bar-descriptor.xml" openeditor="true"/> <file source="project.pro" target="%ProjectName%.pro" openproject="true"/> + <file source="../../qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h" target="qmlapplicationviewer/qmlapplicationviewer.h" /> + <file source="../../qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp" target="qmlapplicationviewer/qmlapplicationviewer.cpp" /> + <file source="../../qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri" target="qmlapplicationviewer/qmlapplicationviewer.pri" /> </files> </wizard> |