diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2013-05-29 16:24:12 +0200 |
---|---|---|
committer | Eskil Abrahamsen-Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2013-05-30 13:02:01 +0300 |
commit | 792602c8aaf387556c0035fc894493a20699c7e8 (patch) | |
tree | 9ac1744e06c861e5f08e1673f4e8fe37f6e720da /experimental/qt5-intro-android/main.cpp | |
parent | 8b56d4f90dd63abf90817b3f54b1fcbbf62bb3c5 (diff) |
Experimental android version of Qt 5 intro
Change-Id: I48041fc2abcf7d46943b5362cf84545e49d8889c
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'experimental/qt5-intro-android/main.cpp')
-rw-r--r-- | experimental/qt5-intro-android/main.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/experimental/qt5-intro-android/main.cpp b/experimental/qt5-intro-android/main.cpp new file mode 100644 index 0000000..f68e26c --- /dev/null +++ b/experimental/qt5-intro-android/main.cpp @@ -0,0 +1,33 @@ +#include <QtGui> +#include <QtQuick> + +QtMessageHandler oldMessageHandler = 0; +void messageHandler(QtMsgType type, const QMessageLogContext &ctx, const QString &msg) +{ + if (type == QtCriticalMsg || type == QtFatalMsg) + oldMessageHandler(type, ctx, msg); +} + +int main(int argc, char **argv) +{ +#if defined(QT_NO_DEBUG) + oldMessageHandler = qInstallMessageHandler(messageHandler); +#endif + + QGuiApplication app(argc, argv); + + QString videoPath = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); + if (!QFile::exists(videoPath + QLatin1String("/Qt5_Animation_small.mp4"))) { + QDir().mkpath(videoPath); + if (!QFile::copy(QLatin1String("assets:/video/Qt5_Animation_small.mp4"), videoPath + QLatin1String("/Qt5_Animation_small.mp4"))) + qWarning("main: Couldn't copy video."); + } + + QQuickView view; + view.engine()->rootContext()->setContextProperty("videoPath", QLatin1String("file://") + videoPath + QLatin1String("/Qt5_Animation_small.mp4")); + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + + return app.exec(); +} |