| 1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <Qt3DQuickExtras/qt3dquickwindow.h> |
| 5 | #include <Qt3DQuick/QQmlAspectEngine> |
| 6 | #include <QGuiApplication> |
| 7 | #include <QQmlEngine> |
| 8 | #include <QQmlContext> |
| 9 | |
| 10 | #ifdef Q_OS_IOS |
| 11 | #include "iosdeviceorientation.h" |
| 12 | #else |
| 13 | #include "dummydeviceorientation.h" |
| 14 | #endif |
| 15 | |
| 16 | int main(int argc, char* argv[]) |
| 17 | { |
| 18 | QGuiApplication app(argc, argv); |
| 19 | |
| 20 | Qt3DExtras::Quick::Qt3DQuickWindow view; |
| 21 | |
| 22 | #ifdef Q_OS_IOS |
| 23 | qmlRegisterType<iOSDeviceOrientation>("Qardboard", 1, 0, "DeviceOrientation"); |
| 24 | #else |
| 25 | qmlRegisterType<DummyDeviceOrientation>("Qardboard", 1, 0, "DeviceOrientation"); |
| 26 | #endif |
| 27 | |
| 28 | view.engine()->qmlEngine()->rootContext()->setContextProperty(QStringLiteral("_window"), &view); |
| 29 | view.setSource(QUrl("qrc:/main.qml")); |
| 30 | #ifdef Q_OS_IOS |
| 31 | view.showFullScreen(); |
| 32 | #else |
| 33 | view.resize(800, 400); |
| 34 | view.show(); |
| 35 | #endif |
| 36 | |
| 37 | return app.exec(); |
| 38 | } |