From 0418e6dc64b196c8db4050f53a42d3f5bf721e8b Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 10 Aug 2012 18:08:18 +0200 Subject: [PATCH] Making the QmlApplicationViewer Qt5 compatible This patch makes a "QmlApplicationViewer" based application from the Qt Quick app wizard buildable and runnable with Qt5. Note, that this is still QtQuick 1.1. We are still missing a QtQuick 2.0 based pendant of QmlApplicationViewer. In addition (separate patch), we may want to tweak the wizard flags in a way that the wizard allows to create a "Qt Quick 1" application for a Qt5 target. (Or perhaps we explicitly do not want that, because we want the developer to use QtQuick 2 with Qt5?) Change-Id: Ie3fc8a77a1ff4fba3244f2047d2685c570014356 Reviewed-by: Eike Ziller Reviewed-by: Alessandro Portale --- .../qmlapplicationviewer/qmlapplicationviewer.cpp | 4 ++++ .../qmlapplicationviewer/qmlapplicationviewer.pri | 6 +++++- src/plugins/qt4projectmanager/wizards/qtquickapp.cpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp index 68613375665..a8a7ccb5ceb 100644 --- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -116,6 +116,7 @@ void QmlApplicationViewer::addImportPath(const QString &path) void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) { +#if QT_VERSION < 0x050000 #if defined(Q_OS_SYMBIAN) // If the version of Qt on the device is < 4.7.2, that attribute won't work if (orientation != ScreenOrientationAuto) { @@ -155,6 +156,9 @@ void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) #endif // QT_VERSION < 0x040702 }; setAttribute(attribute, true); +#else // QT_VERSION < 0x050000 + Q_UNUSED(orientation) +#endif // QT_VERSION < 0x050000 } void QmlApplicationViewer::showExpanded() diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri index a32c88d1ae9..0fd61405edd 100644 --- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri +++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri @@ -4,7 +4,11 @@ # It is recommended not to modify this file, since newer versions of Qt Creator # may offer an updated version of it. -QT += declarative +equals(QT_MAJOR_VERSION, 5) { + QT += quick1 +} else { + QT += declarative +} SOURCES += $$PWD/qmlapplicationviewer.cpp HEADERS += $$PWD/qmlapplicationviewer.h diff --git a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp index 5abba5fa3a5..68e12e8c3dc 100644 --- a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp @@ -463,7 +463,7 @@ QString QtQuickApp::componentSetDir(ComponentSet componentSet) const } } -const int QtQuickApp::StubVersion = 21; +const int QtQuickApp::StubVersion = 22; } // namespace Internal } // namespace Qt4ProjectManager