Commit 8c1b8239 authored by Alessandro Portale's avatar Alessandro Portale

QmlProjectManager: Qt Quick UI templates via json wizard

Using the new .json wizard engine allows us to get rid of much old
custom wizard logic. As additional benefit for the end user of Qt
Creator, the .qml.ui split is now optional.

Change-Id: Ic6d35e650cf0a7735cdfac9080f95015309a5879
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 039a29d5
import QtQuick 1.1
Rectangle {
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BZ"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.1.1">
<displayname>Qt Quick 1.1</displayname>
<description>Creates a Qt Quick 1 UI project with a single QML file that contains the main view. You can review Qt Quick 1 UI projects in the QML Viewer and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 4.8 or newer.</description>
</template>
import QtQuick 2.1
Rectangle {
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BY"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.1">
<displayname>Qt Quick 2.1</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.1 or newer.</description>
</template>
import QtQuick 2.2
Rectangle {
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BX"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.2">
<displayname>Qt Quick 2.2</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.2 or newer.</description>
</template>
import QtQuick 2.3
Rectangle {
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BW"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.3">
<displayname>Qt Quick 2.3</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.3 or newer.</description>
</template>
import QtQuick 2.3
Rectangle {
property alias mouseArea: mouseArea
width: 360
height: 360
MouseArea {
id: mouseArea
anchors.fill: parent
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}
import QtQuick 2.4
MainForm {
mouseArea.onClicked: {
Qt.quit();
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BV"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.UiFiles">
<displayname>Qt Quick 2.4</displayname>
<description>Creates a Qt Quick 2 UI project that contains a .ui.qml file. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. Requires Qt 5.4 or newer.</description>
</template>
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.0
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
Button {
text: qsTr("Hello World")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="AZ"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.0">
<displayname>Qt Quick Controls 1.0</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.1 or newer.</description>
</template>
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Window 2.1
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
Button {
text: qsTr("Hello World")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="AY"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.1">
<displayname>Qt Quick Controls 1.1</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.2 or newer.</description>
</template>
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
Button {
text: qsTr("Hello World")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="AX"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.2">
<displayname>Qt Quick Controls 1.2</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.3 or newer.</description>
</template>
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
Item {
width: 640
height: 480
property alias button3: button3
property alias button2: button2
property alias button1: button1
RowLayout {
anchors.centerIn: parent
Button {
id: button1
text: qsTr("Press Me 1")
}
Button {
id: button2
text: qsTr("Press Me 2")
}
Button {
id: button3
text: qsTr("Press Me 3")
}
}
}
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
menuBar: MenuBar {
Menu {
title: qsTr("&File")
MenuItem {
text: qsTr("&Open")
onTriggered: messageDialog.show(qsTr("Open action triggered"));
}
MenuItem {
text: qsTr("E&xit")
onTriggered: Qt.quit();
}
}
}
MainForm {
anchors.fill: parent
button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
button3.onClicked: messageDialog.show(qsTr("Button 3 pressed"))
}
MessageDialog {
id: messageDialog
title: qsTr("May I have your attention, please?")
function show(caption) {
messageDialog.text = caption;
messageDialog.open();
}
}
}
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="AW"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.3 QtSupport.Wizards.FeatureQtQuick.UiFiles">
<displayname>Qt Quick Controls 1.3</displayname>
<description>Creates a Qt Quick 2 UI project that contains a .ui.qml file and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
</template>
......@@ -3,8 +3,7 @@
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
mainFile: "%{MainQmlFileName}"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
......
{
"version": 1,
"kind": "project",
"id": "QA.QMLB Application",
"category": "F.Application",
"trDescription": "Creates a Qt Quick 2 UI project.",
"trDisplayName": "Qt Quick UI",
"trDisplayCategory": "Application",
"icon": "../../qmake/qtquickapplication/qml_wizard.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.Controls.1.3", "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQt" ],
"options":
[
{ "key": "QmlProjectFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qmlproject')}" },
{ "key": "MainQmlFileName", "value": "%{JS: Util.fileName('%{ProjectName}', 'qml')}" },
{ "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.qtQuickVersion}" },
{ "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.qtQuickWindowVersion}" }
],
"pages":
[
{
"trDisplayName": "Project Location",
"trShortTitle": "Location",
"typeId": "Project",
"data": { "trDescription": "Creates a Qt Quick UI project." }
},
{
"trDisplayName": "Define Project Details",
"trShortTitle": "Details",
"typeId": "Fields",
"data":
[
{
"name": "QtVersion",
"trDisplayName": "Minimal required Qt version:",
"type": "ComboBox",
"data":
{
"items":
[
{
"trKey": "Qt 5.5",
"value":
"{
'qtQuickVersion': '2.5',
'qtQuickWindowVersion': '2.2'
}"
},
{
"trKey": "Qt 5.4",
"value":
"{
'qtQuickVersion': '2.4',
'qtQuickWindowVersion': '2.2'
}"
},
{
"trKey": "Qt 5.3",
"value":
"{
'qtQuickVersion': '2.3',
'qtQuickWindowVersion': '2.2'
}"
}
]
}
},
{
"name": "QmlUISplit",
"trDisplayName": "With ui.qml file",
"type": "CheckBox",
"data":
{
"checkedValue": true,
"uncheckedValue": false,
"checked": false
}
}
]
},
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
],
"generators":
[
{
"typeId": "File",
"data":
[
{
"source": "app.qmlproject",
"target": "%{QmlProjectFileName}",
"openAsProject": true
},
{