summaryrefslogtreecommitdiff
path: root/share/qtcreator/templates/qtquick
diff options
context:
space:
mode:
authorjkobus <jaroslaw.kobus@digia.com>2013-11-06 16:42:25 +0100
committerJarek Kobus <jaroslaw.kobus@digia.com>2013-11-11 15:27:35 +0100
commitc31b03f1d0fecec559de5a877f2ea3d4e52b1dbc (patch)
treee6e1599036a2d584b9f6b1e5ddde68d7de412a60 /share/qtcreator/templates/qtquick
parenta0554422dcb4c7508470e6bcb0bd03b947496d96 (diff)
downloadqt-creator-c31b03f1d0fecec559de5a877f2ea3d4e52b1dbc.tar.gz
Restructure qtquick templates, read them dynamically
Change-Id: I11dfac8ce8d6b1e68df0151516cdc03247fffe3a Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'share/qtcreator/templates/qtquick')
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/app.pro31
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/main.cpp15
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/qml/app/main.qml16
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp114
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h43
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri11
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/template.xml9
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/app.pro27
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/main.cpp13
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/qml/app/main.qml16
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp82
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h32
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri11
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/template.xml9
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro22
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp12
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml/app/main.qml23
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp101
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h41
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri11
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml9
21 files changed, 648 insertions, 0 deletions
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro b/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro
new file mode 100644
index 0000000000..19aef27281
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro
@@ -0,0 +1,31 @@
+# Add more folders to ship with the application, here
+# DEPLOYMENTFOLDERS #
+folder_01.source = qml/app
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+# DEPLOYMENTFOLDERS_END #
+
+# Additional import path used to resolve QML modules in Creator's code model
+# QML_IMPORT_PATH #
+QML_IMPORT_PATH =
+
+# If your application uses the Qt Mobility libraries, uncomment the following
+# lines and add the respective components to the MOBILITY variable.
+# CONFIG += mobility
+# MOBILITY +=
+
+# Speed up launching on MeeGo/Harmattan when using applauncherd daemon
+# HARMATTAN_BOOSTABLE #
+# CONFIG += qdeclarative-boostable
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(qtquick1applicationviewer/qtquick1applicationviewer.pri)
+# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qtquick1applicationviewer.pri, instead) #
+include(../shared/deployment.pri)
+qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/main.cpp b/share/qtcreator/templates/qtquick/qtquick_1_1/main.cpp
new file mode 100644
index 0000000000..da0c307555
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/main.cpp
@@ -0,0 +1,15 @@
+#include "qtquick1applicationviewer.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QtQuick1ApplicationViewer viewer;
+ viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
+ viewer.setOrientation(QtQuick1ApplicationViewer::ScreenOrientationAuto); // ORIENTATION
+ viewer.setMainQmlFile(QLatin1String("qml/app/main.qml")); // MAINQML
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qml/app/main.qml b/share/qtcreator/templates/qtquick/qtquick_1_1/qml/app/main.qml
new file mode 100644
index 0000000000..460a22fc2c
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/qml/app/main.qml
@@ -0,0 +1,16 @@
+import QtQuick 1.1
+
+Rectangle {
+ width: 360
+ height: 360
+ Text {
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
+ }
+ }
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp b/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp
new file mode 100644
index 0000000000..d487e109f9
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp
@@ -0,0 +1,114 @@
+/*
+ This file was generated by the Qt Quick 1 Application wizard of Qt Creator.
+ QtQuick1ApplicationViewer is a convenience class containing mobile device
+ specific code such as screen orientation handling. Also QML paths are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#include "qtquick1applicationviewer.h"
+
+#include <QDir>
+#include <QFileInfo>
+#include <QApplication>
+#include <QDeclarativeComponent>
+#include <QDeclarativeEngine>
+#include <QDeclarativeContext>
+
+#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
+
+class QtQuick1ApplicationViewerPrivate
+{
+ QString mainQmlFile;
+ friend class QtQuick1ApplicationViewer;
+ static QString adjustPath(const QString &path);
+};
+
+QString QtQuick1ApplicationViewerPrivate::adjustPath(const QString &path)
+{
+#ifdef Q_OS_MAC
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_BLACKBERRY)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("app/native/%1").arg(path);
+#elif !defined(Q_OS_ANDROID)
+ QString pathInInstallDir =
+ QString::fromLatin1("%1/../%2").arg(
+ QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+ pathInInstallDir =
+ QString::fromLatin1("%1/%2").arg(
+ QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#endif
+ return path;
+}
+
+QtQuick1ApplicationViewer::QtQuick1ApplicationViewer(QWidget *parent)
+ : QDeclarativeView(parent)
+ , d(new QtQuick1ApplicationViewerPrivate())
+{
+ connect(engine(), SIGNAL(quit()), SLOT(close()));
+ setResizeMode(QDeclarativeView::SizeRootObjectToView);
+}
+
+QtQuick1ApplicationViewer::~QtQuick1ApplicationViewer()
+{
+ delete d;
+}
+
+QtQuick1ApplicationViewer *QtQuick1ApplicationViewer::create()
+{
+ return new QtQuick1ApplicationViewer();
+}
+
+void QtQuick1ApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick1ApplicationViewerPrivate::adjustPath(file);
+#ifdef Q_OS_ANDROID
+ setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
+#else
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
+#endif
+}
+
+void QtQuick1ApplicationViewer::addImportPath(const QString &path)
+{
+ engine()->addImportPath(QtQuick1ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick1ApplicationViewer::setOrientation(ScreenOrientation orientation)
+{
+#if QT_VERSION < 0x050000
+ Qt::WidgetAttribute attribute;
+ switch (orientation) {
+ case ScreenOrientationLockPortrait:
+ attribute = Qt::WA_LockPortraitOrientation;
+ break;
+ case ScreenOrientationLockLandscape:
+ attribute = Qt::WA_LockLandscapeOrientation;
+ break;
+ default:
+ case ScreenOrientationAuto:
+ attribute = Qt::WA_AutoOrientation;
+ break;
+ };
+ setAttribute(attribute, true);
+#else // QT_VERSION < 0x050000
+ Q_UNUSED(orientation)
+#endif // QT_VERSION < 0x050000
+}
+
+void QtQuick1ApplicationViewer::showExpanded()
+{
+#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
+ showFullScreen();
+#else
+ show();
+#endif
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h b/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h
new file mode 100644
index 0000000000..b9dc3a9fee
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h
@@ -0,0 +1,43 @@
+/*
+ This file was generated by the Qt Quick 1 Application wizard of Qt Creator.
+ QtQuick1ApplicationViewer is a convenience class containing mobile device
+ specific code such as screen orientation handling. Also QML paths are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#ifndef QTQUICK1APPLICATIONVIEWER_H
+#define QTQUICK1APPLICATIONVIEWER_H
+
+#include <QDeclarativeView>
+
+class QtQuick1ApplicationViewer : public QDeclarativeView
+{
+ Q_OBJECT
+
+public:
+ enum ScreenOrientation {
+ ScreenOrientationLockPortrait,
+ ScreenOrientationLockLandscape,
+ ScreenOrientationAuto
+ };
+
+ explicit QtQuick1ApplicationViewer(QWidget *parent = 0);
+ virtual ~QtQuick1ApplicationViewer();
+
+ static QtQuick1ApplicationViewer *create();
+
+ void setMainQmlFile(const QString &file);
+ void addImportPath(const QString &path);
+
+ // Note that this will only have an effect on Fremantle.
+ void setOrientation(ScreenOrientation orientation);
+
+ void showExpanded();
+
+private:
+ class QtQuick1ApplicationViewerPrivate *d;
+};
+
+#endif // QTQUICK1APPLICATIONVIEWER_H
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri b/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri
new file mode 100644
index 0000000000..030edc1d01
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri
@@ -0,0 +1,11 @@
+# This file was generated by the Qt Quick 1 Application wizard of Qt Creator.
+# The code below adds the QtQuick1ApplicationViewer to the project.
+#
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+QT += declarative
+
+SOURCES += $$PWD/qtquick1applicationviewer.cpp
+HEADERS += $$PWD/qtquick1applicationviewer.h
+INCLUDEPATH += $$PWD
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml b/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml
new file mode 100644
index 0000000000..78a45b4ba5
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="C"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.1.1"
+ viewerdir="qtquick1applicationviewer"
+ viewerclassname="QtQuick1ApplicationViewer"
+ stubversionminor="24">
+ <displayname>Qt Quick 1.1</displayname>
+ <description>Creates a Qt Quick 1 application project that can contain both QML and C++ code and includes a QDeclarativeView. The built-in QML types in the QtQuick 1 namespace allow you to write cross-platform applications with a custom look and feel. Requires Qt 4.8 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro
new file mode 100644
index 0000000000..2495771e53
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro
@@ -0,0 +1,27 @@
+# Add more folders to ship with the application, here
+# DEPLOYMENTFOLDERS #
+folder_01.source = qml/app
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+# DEPLOYMENTFOLDERS_END #
+
+# Additional import path used to resolve QML modules in Creator's code model
+# QML_IMPORT_PATH #
+QML_IMPORT_PATH =
+
+# If your application uses the Qt Mobility libraries, uncomment the following
+# lines and add the respective components to the MOBILITY variable.
+# CONFIG += mobility
+# MOBILITY +=
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
+# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
+include(../shared/deployment.pri)
+qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/main.cpp b/share/qtcreator/templates/qtquick/qtquick_2_0/main.cpp
new file mode 100644
index 0000000000..fd46906328
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/main.cpp
@@ -0,0 +1,13 @@
+#include <QtGui/QGuiApplication>
+#include "qtquick2applicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+ viewer.setMainQmlFile(QStringLiteral("qml/app/main.qml")); // MAINQML
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qml/app/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_0/qml/app/main.qml
new file mode 100644
index 0000000000..897812a6cb
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/qml/app/main.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 360
+ height: 360
+ Text {
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
+ }
+ }
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp
new file mode 100644
index 0000000000..127a25e6c4
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp
@@ -0,0 +1,82 @@
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#include "qtquick2applicationviewer.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+class QtQuick2ApplicationViewerPrivate
+{
+ QString mainQmlFile;
+ friend class QtQuick2ApplicationViewer;
+ static QString adjustPath(const QString &path);
+};
+
+QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
+{
+#if defined(Q_OS_MAC)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_BLACKBERRY)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("app/native/%1").arg(path);
+#elif !defined(Q_OS_ANDROID)
+ QString pathInInstallDir =
+ QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+ pathInInstallDir =
+ QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#elif defined(Q_OS_ANDROID_NO_SDK)
+ return QLatin1String("/data/user/qt/") + path;
+#endif
+ return path;
+}
+
+QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
+ : QQuickView(parent)
+ , d(new QtQuick2ApplicationViewerPrivate())
+{
+ connect(engine(), SIGNAL(quit()), SLOT(close()));
+ setResizeMode(QQuickView::SizeRootObjectToView);
+}
+
+QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
+{
+ delete d;
+}
+
+void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
+#else
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
+#endif
+}
+
+void QtQuick2ApplicationViewer::addImportPath(const QString &path)
+{
+ engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick2ApplicationViewer::showExpanded()
+{
+#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
+ showFullScreen();
+#else
+ show();
+#endif
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h b/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h
new file mode 100644
index 0000000000..6eee3c89b9
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h
@@ -0,0 +1,32 @@
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#ifndef QTQUICK2APPLICATIONVIEWER_H
+#define QTQUICK2APPLICATIONVIEWER_H
+
+#include <QtQuick/QQuickView>
+
+class QtQuick2ApplicationViewer : public QQuickView
+{
+ Q_OBJECT
+
+public:
+ explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
+ virtual ~QtQuick2ApplicationViewer();
+
+ void setMainQmlFile(const QString &file);
+ void addImportPath(const QString &path);
+
+ void showExpanded();
+
+private:
+ class QtQuick2ApplicationViewerPrivate *d;
+};
+
+#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri b/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri
new file mode 100644
index 0000000000..5123a2567e
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri
@@ -0,0 +1,11 @@
+# This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+# The code below adds the QtQuick2ApplicationViewer to the project and handles
+# the activation of QML debugging.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+QT += qml quick
+
+SOURCES += $$PWD/qtquick2applicationviewer.cpp
+HEADERS += $$PWD/qtquick2applicationviewer.h
+INCLUDEPATH += $$PWD
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml
new file mode 100644
index 0000000000..b3868c7161
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="B"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
+ viewerdir="qtquick2applicationviewer"
+ viewerclassname="QtQuick2ApplicationViewer"
+ stubversionminor="5">
+ <displayname>Qt Quick 2.0</displayname>
+ <description>Creates a Qt Quick 2 application project that can contain both QML and C++ code and includes a QQuickView. The built-in QML types in the QtQuick 2 namespace allow you to write cross-platform applications with a custom look and feel. Requires Qt 5.0 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
new file mode 100644
index 0000000000..be20dc0770
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
@@ -0,0 +1,22 @@
+# Add more folders to ship with the application, here
+# DEPLOYMENTFOLDERS #
+folder_01.source = qml/app
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+# DEPLOYMENTFOLDERS_END #
+
+# Additional import path used to resolve QML modules in Creator's code model
+# QML_IMPORT_PATH #
+QML_IMPORT_PATH =
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri)
+# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
+include(../shared/deployment.pri)
+qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp
new file mode 100644
index 0000000000..18fd2076cf
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/main.cpp
@@ -0,0 +1,12 @@
+#include "qtquick2controlsapplicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ Application app(argc, argv);
+
+ QtQuick2ControlsApplicationViewer viewer;
+ viewer.setMainQmlFile(QStringLiteral("qml/app/main.qml")); // MAINQML
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml/app/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml/app/main.qml
new file mode 100644
index 0000000000..4069d1e713
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qml/app/main.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+
+ApplicationWindow {
+ title: qsTr("Hello World")
+ width: 640
+ height: 480
+
+ menuBar: MenuBar {
+ Menu {
+ title: qsTr("File")
+ MenuItem {
+ text: qsTr("Exit")
+ onTriggered: Qt.quit();
+ }
+ }
+ }
+
+ Button {
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ }
+}
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp
new file mode 100644
index 0000000000..7198a903b4
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp
@@ -0,0 +1,101 @@
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ControlsApplicationViewer is a convenience class.
+ QML paths are handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+#include "qtquick2controlsapplicationviewer.h"
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QQmlComponent>
+#include <QQmlEngine>
+#include <QQuickView>
+
+class QtQuick2ApplicationViewerPrivate
+{
+ QString mainQmlFile;
+ QQmlEngine engine;
+ QQuickWindow *window;
+
+ QtQuick2ApplicationViewerPrivate() : window(0)
+ {}
+
+ ~QtQuick2ApplicationViewerPrivate()
+ {
+ delete window;
+ }
+
+ static QString adjustPath(const QString &path);
+
+ friend class QtQuick2ControlsApplicationViewer;
+};
+
+QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
+{
+#if defined(Q_OS_MAC)
+ if (!QDir::isAbsolutePath(path))
+ return QStringLiteral("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_BLACKBERRY)
+ if (!QDir::isAbsolutePath(path))
+ return QStringLiteral("app/native/%1").arg(path);
+#elif !defined(Q_OS_ANDROID)
+ QString pathInInstallDir =
+ QStringLiteral("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+ pathInInstallDir =
+ QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#endif
+ return path;
+}
+
+QtQuick2ControlsApplicationViewer::QtQuick2ControlsApplicationViewer()
+ : d(new QtQuick2ApplicationViewerPrivate())
+{
+
+}
+
+QtQuick2ControlsApplicationViewer::~QtQuick2ControlsApplicationViewer()
+{
+ delete d;
+}
+
+void QtQuick2ControlsApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
+
+ QQmlComponent component(&d->engine);
+
+ QObject::connect(&d->engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
+
+#ifdef Q_OS_ANDROID
+ component.loadUrl(QUrl(QStringLiteral("assets:/")+d->mainQmlFile));
+#else
+ component.loadUrl(QUrl::fromLocalFile(d->mainQmlFile));
+#endif
+
+ if (!component.isReady())
+ qWarning("%s", qPrintable(component.errorString()));
+
+ d->window = qobject_cast<QQuickWindow *>(component.create());
+ if (!d->window)
+ qFatal("Error: Your root item has to be a Window.");
+
+ d->engine.setIncubationController(d->window->incubationController());
+}
+
+void QtQuick2ControlsApplicationViewer::addImportPath(const QString &path)
+{
+ d->engine.addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick2ControlsApplicationViewer::show()
+{
+ if (d->window)
+ d->window->show();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h
new file mode 100644
index 0000000000..76c12b7720
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h
@@ -0,0 +1,41 @@
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ControlsApplicationViewer is a convenience class.
+ QML paths are handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+#ifndef QTQUICK2APPLICATIONVIEWER_H
+#define QTQUICK2APPLICATIONVIEWER_H
+
+#ifndef QT_NO_WIDGETS
+#include <QApplication>
+#else
+#include <QGuiApplication>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_WIDGETS
+#define Application QApplication
+#else
+#define Application QGuiApplication
+#endif
+
+QT_END_NAMESPACE
+
+class QtQuick2ControlsApplicationViewer
+{
+public:
+ explicit QtQuick2ControlsApplicationViewer();
+ virtual ~QtQuick2ControlsApplicationViewer();
+
+ void setMainQmlFile(const QString &file);
+ void addImportPath(const QString &path);
+ void show();
+
+private:
+ class QtQuick2ApplicationViewerPrivate *d;
+};
+
+#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri
new file mode 100644
index 0000000000..32007f73fd
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri
@@ -0,0 +1,11 @@
+# This file was generated by the Qt Quick 2 Controls Application wizard of Qt Creator.
+# The code below adds the QtQuick2ApplicationViewer to the project and handles
+# the activation of QML debugging.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+QT += qml quick widgets
+
+SOURCES += $$PWD/qtquick2controlsapplicationviewer.cpp
+HEADERS += $$PWD/qtquick2controlsapplicationviewer.h
+INCLUDEPATH += $$PWD
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
new file mode 100644
index 0000000000..45b12b8207
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="A"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
+ viewerdir="qtquick2controlsapplicationviewer"
+ viewerclassname="QtQuick2ControlsApplicationViewer"
+ stubversionminor="1">
+ <displayname>Qt Quick Controls 1.0</displayname>
+ <description>Creates a Qt Quick 2 application project that can contain both QML and C++ code and includes a QQuickView. Creates a deployable Qt Quick application using Qt Quick Controls. All files and directories that reside in the same directory as the main .qml file are deployed. You can modify the contents of the directory any time before deploying. Requires Qt 5.1 or newer.</description>
+</template>