1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include <QtGui/QApplication>
- #include <QtGui/QDesktopWidget>
- #include <QtDeclarative/QDeclarativeContext>
- #include "qmlapplicationviewer.h"
- int main(int argc, char *argv[])
- {
- QApplication app(argc, argv);
- // Get screen geometry
- #ifdef Q_WS_MAEMO_5
- const QRect screenRect(0,0,800, 480);
- const QLatin1String mainQML("qml/FutuHeia/maemo5/main.qml");
- #else
- const QRect screenRect(0,0,360, 640);
- const QLatin1String mainQML("qml/FutuHeia/symbian3/main.qml");
- #endif
- QmlApplicationViewer viewer;
- // Set screen width and height to QML context
- QDeclarativeContext* context = viewer.rootContext();
- context->setContextProperty("screenWidth", screenRect.width());
- context->setContextProperty("screenHeight", screenRect.height());
- viewer.resize(screenRect.width(), screenRect.height());
- #ifdef Q_WS_MAEMO_5
- viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
- #else
- viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
- #endif
- viewer.setMainQmlFile(mainQML);
- #ifdef Q_WS_MAEMO_5
- viewer.showFullScreen();
- #elif defined(Q_WS_S60)
- viewer.showFullScreen();
- #else
- viewer.showExpanded();
- #endif
- return app.exec();
- }
|