summaryrefslogtreecommitdiffstats
path: root/basicsuite/shared/main.cpp
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@theqtcompany.com>2015-05-29 13:21:19 +0300
committerSamuli Piippo <samuli.piippo@theqtcompany.com>2015-05-29 15:44:51 +0300
commit57fa34d2c09529b71e2fdfec077c0f35e9cd7624 (patch)
treea42edd55fa0569bdfde8d66ad5833d93ab8506e2 /basicsuite/shared/main.cpp
parenta6675bd8fc1d8fcf6d0ab60f60e471f0012b2ece (diff)
Make standalone demos work with 2d renderer5.4
Standalone application did not work in non-gpu devices (colibri vf), when the root item did not have size set. Fix this by using the same code as qtlancher has: - QQmlApplicationEngine instead of QQuickView - only one main qml file - Window as root item Change-Id: I482dd86e44faac5dac1839dfb88c5647a0425de6 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@theqtcompany.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
Diffstat (limited to 'basicsuite/shared/main.cpp')
-rw-r--r--basicsuite/shared/main.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/basicsuite/shared/main.cpp b/basicsuite/shared/main.cpp
index 9ddb61b..1429260 100644
--- a/basicsuite/shared/main.cpp
+++ b/basicsuite/shared/main.cpp
@@ -24,11 +24,9 @@
#include <QtGui/QScreen>
#include <QtGui/QPalette>
#include <QtCore/QRegExp>
+#include <QtCore/QFile>
-#if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
-#include <QtQuick/QQuickItem>
-#endif
-#include <QtQuick/QQuickView>
+#include <QtQml/QQmlApplicationEngine>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
@@ -84,25 +82,11 @@ int main(int argc, char **argv)
QGuiApplication::setFont(font);
}
- QQuickView view;
-#if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
- // Ensure the width and height are valid because of QTBUG-36938.
- QObject::connect(&view, SIGNAL(widthChanged(int)), view.contentItem(), SLOT(setWidth(int)));
- QObject::connect(&view, SIGNAL(heightChanged(int)), view.contentItem(), SLOT(setHeight(int)));
-#endif
-
DummyEngine engine;
- view.rootContext()->setContextProperty("engine", &engine);
- view.setColor(Qt::black);
- view.setResizeMode(QQuickView::SizeRootObjectToView);
-
- QSize screenSize = QGuiApplication::primaryScreen()->size();
- QString mainFile = screenSize.width() < screenSize.height()
- ? QStringLiteral("/main_landscape.qml")
- : QStringLiteral("/SharedMain.qml");
- view.setSource(QUrl::fromLocalFile(path + mainFile));
- view.show();
+ QQmlApplicationEngine applicationengine;
+ applicationengine.rootContext()->setContextProperty("engine", &engine);
+ applicationengine.load(QUrl::fromLocalFile(path + "/SharedMain.qml"));
app.exec();
}