aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@theqtcompany.com>2016-05-06 13:54:18 +0200
committerAlessandro Portale <alessandro.portale@theqtcompany.com>2016-05-19 10:59:17 +0000
commit646bf84c60b899ca3893d52584b4d6fdcd8d6110 (patch)
tree9e442c4b9f3b489d3b5fe2ce94671dad4f5dc4ad /share
parent11ef0db2fd1ac57c261cfa1721b04d8038eb57d9 (diff)
Wizards: Add an application wizard for QtQuick.Controls.2
Change-Id: I516a0b016d57d997624a449ec58e56e3af3f265f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtlabscontrolsapplication/wizard.json2
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1.qml.tpl10
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1Form.ui.qml.tpl22
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro13
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.cpp12
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.qml.tpl37
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/qml.qrc7
-rw-r--r--share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/wizard.json86
8 files changed, 188 insertions, 1 deletions
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtlabscontrolsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtlabscontrolsapplication/wizard.json
index 381e050851..35b4f4f1b4 100644
--- a/share/qtcreator/templates/wizards/projects/qmake/qtlabscontrolsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtlabscontrolsapplication/wizard.json
@@ -3,7 +3,7 @@
"supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
"id": "W.QtLabsControlsApplication",
"category": "F.Application",
- "trDescription": "Creates a deployable Qt Quick 2 application using Qt Labs Controls.",
+ "trDescription": "Creates a deployable Qt Quick 2 application using Qt Labs Controls.<br/><br/><b>Note:</b> Qt Labs Controls are only available with Qt 5.6. Choose <em>Qt Quick Controls 2 Application</em> when targeting Qt 5.7 or later.",
"trDisplayName": "Qt Labs Controls Application",
"trDisplayCategory": "Application",
"icon": "../qtquickapplication/qml_wizard.png",
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1.qml.tpl b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1.qml.tpl
new file mode 100644
index 0000000000..bb8b52b439
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1.qml.tpl
@@ -0,0 +1,10 @@
+import QtQuick %{QtQuickVersion}
+
+Page1Form {
+ button1.onClicked: {
+ console.log("Button 1 clicked.");
+ }
+ button2.onClicked: {
+ console.log("Button 2 clicked.");
+ }
+}
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1Form.ui.qml.tpl b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1Form.ui.qml.tpl
new file mode 100644
index 0000000000..1f831a02ab
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/Page1Form.ui.qml.tpl
@@ -0,0 +1,22 @@
+import QtQuick %{QtQuickVersion}
+import QtQuick.Controls %{QtQuickControls2Version}
+import QtQuick.Layouts %{QtQuickLayoutsVersion}
+
+Item {
+ property alias button1: button1
+ property alias button2: button2
+
+ RowLayout {
+ anchors.centerIn: parent
+
+ Button {
+ id: button1
+ text: qsTr("Press Me 1")
+ }
+
+ Button {
+ id: button2
+ text: qsTr("Press Me 2")
+ }
+ }
+}
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro
new file mode 100644
index 0000000000..d778e1cb34
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro
@@ -0,0 +1,13 @@
+QT += qml quick
+
+CONFIG += c++11
+
+SOURCES += %{MainCppFileName}
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =
+
+# Default rules for deployment.
+include(deployment.pri)
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.cpp b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.cpp
new file mode 100644
index 0000000000..4142815437
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.cpp
@@ -0,0 +1,12 @@
+%{Cpp:LicenseTemplate}\
+%{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])}
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QLatin1String("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.qml.tpl b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.qml.tpl
new file mode 100644
index 0000000000..2634984459
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/main.qml.tpl
@@ -0,0 +1,37 @@
+import QtQuick %{QtQuickVersion}
+import QtQuick.Controls %{QtQuickControls2Version}
+import QtQuick.Layouts %{QtQuickLayoutsVersion}
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("Hello World")
+
+ SwipeView {
+ id: swipeView
+ anchors.fill: parent
+ currentIndex: tabBar.currentIndex
+
+ Page1 {
+ }
+
+ Page {
+ Label {
+ text: qsTr("Second page")
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ footer: TabBar {
+ id: tabBar
+ currentIndex: swipeView.currentIndex
+ TabButton {
+ text: qsTr("First")
+ }
+ TabButton {
+ text: qsTr("Second")
+ }
+ }
+}
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/qml.qrc b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/qml.qrc
new file mode 100644
index 0000000000..67415af311
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/qml.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>Page1.qml</file>
+ <file>Page1Form.ui.qml</file>
+ </qresource>
+</RCC>
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/wizard.json
new file mode 100644
index 0000000000..705a4f9f1a
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/wizard.json
@@ -0,0 +1,86 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
+ "id": "V.QtQuickControls2Application",
+ "category": "F.Application",
+ "trDescription": "Creates a deployable Qt Quick 2 application using Qt Quick Controls 2.<br/><br/><b>Note:</b> Qt Quick Controls 2 are available with Qt 5.7 and later. Choose <em>Qt Labs Controls Application</em> when targeting Qt 5.6.",
+ "trDisplayName": "Qt Quick Controls 2 Application",
+ "trDisplayCategory": "Application",
+ "icon": "../qtquickapplication/qml_wizard.png",
+ "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.2" ],
+ "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
+
+ "options":
+ [
+ { "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
+ { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
+ { "key": "QtQuickVersion", "value": "2.7" },
+ { "key": "QtQuickControls2Version", "value": "2.0" },
+ { "key": "QtQuickDialogsVersion", "value": "1.0" },
+ { "key": "QtQuickLayoutsVersion", "value": "1.0" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project"
+ },
+ {
+ "trDisplayName": "Kit Selection",
+ "trShortTitle": "Kits",
+ "typeId": "Kits",
+ "enabled": "%{IsTopLevelProject}",
+ "data": { "projectFilePath": "%{ProFileName}" }
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "app.pro",
+ "target": "%{ProFileName}",
+ "openAsProject": true
+ },
+ {
+ "source": "main.cpp",
+ "target": "%{MainCppFileName}"
+ },
+ {
+ "source": "main.qml.tpl",
+ "target": "main.qml",
+ "openInEditor": true
+ },
+ {
+ "source": "Page1.qml.tpl",
+ "target": "Page1.qml"
+ },
+ {
+ "source": "Page1Form.ui.qml.tpl",
+ "target": "Page1Form.ui.qml"
+ },
+ {
+ "source": "qml.qrc"
+ },
+ {
+ "source": "../../../../shared/qrcdeployment.pri",
+ "target": "%{ProjectDirectory}/deployment.pri"
+ },
+ {
+ "source": "../../git.ignore",
+ "target": "%{ProjectDirectory}/.gitignore",
+ "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}"
+ }
+ ]
+ }
+ ]
+}