Commit 2910233e authored by Kevin Krammer's avatar Kevin Krammer Committed by Eike Ziller
Browse files

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: default avatarMehdi Fekari <mfekari@rim.com>
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent 62b400cd
......@@ -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();
......
#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();
}
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 =
......
......@@ -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>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment