forked from qt-creator/qt-creator
Wizards: Add a Qt Quick Controls 2 "Stack" wizard
For applications with stack navigation Change-Id: I33eea6460ad416755d25660f206dfe61ec555b88 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import QtQuick %{QtQuickVersion}
|
||||
import QtQuick.Controls %{QtQuickControlsVersion}
|
||||
|
||||
Page {
|
||||
width: 600
|
||||
height: 400
|
||||
|
||||
title: qsTr("Home")
|
||||
|
||||
Label {
|
||||
text: qsTr("You are on the home page.")
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import QtQuick %{QtQuickVersion}
|
||||
import QtQuick.Controls %{QtQuickControlsVersion}
|
||||
|
||||
Page {
|
||||
width: 600
|
||||
height: 400
|
||||
|
||||
title: qsTr("Page 1")
|
||||
|
||||
Label {
|
||||
text: qsTr("You are on Page 1.")
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import QtQuick %{QtQuickVersion}
|
||||
import QtQuick.Controls %{QtQuickControlsVersion}
|
||||
|
||||
Page {
|
||||
width: 600
|
||||
height: 400
|
||||
|
||||
title: qsTr("Page 2")
|
||||
|
||||
Label {
|
||||
text: qsTr("You are on Page 2.")
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 851 B |
@@ -0,0 +1,99 @@
|
||||
import QtQuick %{QtQuickVersion}
|
||||
import QtQuick.Controls %{QtQuickControlsVersion}
|
||||
@if %{UseVirtualKeyboard}
|
||||
import %{QtQuickVirtualKeyboardImport}
|
||||
@endif
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
visible: true
|
||||
width: 640
|
||||
height: 480
|
||||
title: qsTr("Stack")
|
||||
|
||||
header: ToolBar {
|
||||
contentHeight: toolButton.implicitHeight
|
||||
|
||||
ToolButton {
|
||||
id: toolButton
|
||||
text: stackView.depth > 1 ? "\\u25C0" : "\\u2630"
|
||||
font.pixelSize: Qt.application.font.pixelSize * 1.6
|
||||
onClicked: {
|
||||
if (stackView.depth > 1) {
|
||||
stackView.pop()
|
||||
} else {
|
||||
drawer.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: stackView.currentItem.title
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Drawer {
|
||||
id: drawer
|
||||
width: window.width * 0.66
|
||||
height: window.height
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
ItemDelegate {
|
||||
text: qsTr("Page 1")
|
||||
width: parent.width
|
||||
onClicked: {
|
||||
stackView.push("Page1Form.ui.qml")
|
||||
drawer.close()
|
||||
}
|
||||
}
|
||||
ItemDelegate {
|
||||
text: qsTr("Page 2")
|
||||
width: parent.width
|
||||
onClicked: {
|
||||
stackView.push("Page2Form.ui.qml")
|
||||
drawer.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: stackView
|
||||
initialItem: "HomeForm.ui.qml"
|
||||
anchors.fill: parent
|
||||
}
|
||||
@if %{UseVirtualKeyboard}
|
||||
|
||||
InputPanel {
|
||||
id: inputPanel
|
||||
z: 99
|
||||
x: 0
|
||||
y: window.height
|
||||
width: window.width
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: inputPanel.active
|
||||
PropertyChanges {
|
||||
target: inputPanel
|
||||
y: window.height - inputPanel.height
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
from: ""
|
||||
to: "visible"
|
||||
reversible: true
|
||||
ParallelAnimation {
|
||||
NumberAnimation {
|
||||
properties: "y"
|
||||
duration: 250
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@endif
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>HomeForm.ui.qml</file>
|
||||
<file>Page1Form.ui.qml</file>
|
||||
<file>Page2Form.ui.qml</file>
|
||||
<file>qtquickcontrols2.conf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,281 @@
|
||||
{
|
||||
"version": 1,
|
||||
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
|
||||
"id": "V.QtQuickApplicationStack",
|
||||
"category": "F.Application",
|
||||
"trDescription": "Creates a Qt Quick Controls application with a StackView to display content, and a Drawer and ToolBar for navigation.",
|
||||
"trDisplayName": "Qt Quick Application - Stack",
|
||||
"trDisplayCategory": "Application",
|
||||
"icon": "icon.png",
|
||||
"featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.7" ],
|
||||
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}",
|
||||
|
||||
"options":
|
||||
[
|
||||
{ "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" },
|
||||
{ "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
|
||||
{ "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" },
|
||||
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
|
||||
{ "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
|
||||
{ "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" },
|
||||
{ "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" },
|
||||
{ "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" },
|
||||
{ "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" },
|
||||
{ "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" },
|
||||
{ "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" },
|
||||
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" },
|
||||
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" }
|
||||
],
|
||||
|
||||
"pages":
|
||||
[
|
||||
{
|
||||
"trDisplayName": "Project Location",
|
||||
"trShortTitle": "Location",
|
||||
"typeId": "Project"
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Define Build System",
|
||||
"trShortTitle": "Build System",
|
||||
"typeId": "Fields",
|
||||
"enabled": "%{JS: ! %{IsSubproject}}",
|
||||
"data":
|
||||
[
|
||||
{
|
||||
"name": "BuildSystem",
|
||||
"trDisplayName": "Build system:",
|
||||
"type": "ComboBox",
|
||||
"data":
|
||||
{
|
||||
"index": 0,
|
||||
"items":
|
||||
[
|
||||
{
|
||||
"trKey": "qmake",
|
||||
"value": "qmake",
|
||||
"condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}"
|
||||
},
|
||||
{
|
||||
"trKey": "CMake",
|
||||
"value": "cmake",
|
||||
"condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}"
|
||||
},
|
||||
{
|
||||
"trKey": "Qbs",
|
||||
"value": "qbs",
|
||||
"condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Define Project Details",
|
||||
"trShortTitle": "Details",
|
||||
"typeId": "Fields",
|
||||
"data":
|
||||
[
|
||||
{
|
||||
"name": "QtVersion",
|
||||
"trDisplayName": "Minimal required Qt version:",
|
||||
"type": "ComboBox",
|
||||
"data":
|
||||
{
|
||||
"index": 0,
|
||||
"items":
|
||||
[
|
||||
{
|
||||
"trKey": "Qt 5.9",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickVersion': '2.9',
|
||||
'QtQuickControlsVersion': '2.2',
|
||||
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Qt 5.8",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickVersion': '2.8',
|
||||
'QtQuickControlsVersion': '2.1',
|
||||
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Qt 5.7",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickVersion': '2.7',
|
||||
'QtQuickControlsVersion': '2.0',
|
||||
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1'
|
||||
}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ControlsStyle",
|
||||
"trDisplayName": "Qt Quick Controls Style:",
|
||||
"type": "ComboBox",
|
||||
"data":
|
||||
{
|
||||
"index": 0,
|
||||
"items":
|
||||
[
|
||||
{
|
||||
"trKey": "Default",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Default',
|
||||
'QtQuickControlsStyleTheme': ''
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Material Light",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Material',
|
||||
'QtQuickControlsStyleTheme': 'Light'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Material Dark",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Material',
|
||||
'QtQuickControlsStyleTheme': 'Dark'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Universal Light",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Universal',
|
||||
'QtQuickControlsStyleTheme': 'Light'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Universal Dark",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Universal',
|
||||
'QtQuickControlsStyleTheme': 'Dark'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Universal System",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Universal',
|
||||
'QtQuickControlsStyleTheme': 'System'
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Fusion (Qt 5.10+)",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Fusion',
|
||||
'QtQuickControlsStyleTheme': ''
|
||||
}"
|
||||
},
|
||||
{
|
||||
"trKey": "Imagine (Qt 5.10+)",
|
||||
"value":
|
||||
"{
|
||||
'QtQuickControlsStyle': 'Imagine',
|
||||
'QtQuickControlsStyleTheme': ''
|
||||
}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "UseVirtualKeyboard",
|
||||
"trDisplayName": "Use Qt Virtual Keyboard.",
|
||||
"type": "CheckBox",
|
||||
"data":
|
||||
{
|
||||
"checked": "%{JS: %{UseVirtualKeyboardByDefault}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Kit Selection",
|
||||
"trShortTitle": "Kits",
|
||||
"typeId": "Kits",
|
||||
"enabled": "%{JS: ! %{IsSubproject}}",
|
||||
"data": {
|
||||
"projectFilePath": "%{ProjectFile}",
|
||||
"requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Project Management",
|
||||
"trShortTitle": "Summary",
|
||||
"typeId": "Summary"
|
||||
}
|
||||
],
|
||||
"generators":
|
||||
[
|
||||
{
|
||||
"typeId": "File",
|
||||
"data":
|
||||
[
|
||||
{
|
||||
"source": "../app.pro",
|
||||
"target": "%{ProFile}",
|
||||
"openAsProject": true,
|
||||
"condition": "%{JS: '%{BuildSystem}' === 'qmake'}"
|
||||
},
|
||||
{
|
||||
"source": "../CMakeLists.txt",
|
||||
"target": "CMakeLists.txt",
|
||||
"openAsProject": true,
|
||||
"condition": "%{JS: '%{BuildSystem}' === 'cmake'}"
|
||||
},
|
||||
{
|
||||
"source": "../app.qbs",
|
||||
"target": "%{QbsFile}",
|
||||
"openAsProject": true,
|
||||
"condition": "%{JS: '%{BuildSystem}' === 'qbs'}"
|
||||
},
|
||||
{
|
||||
"source": "../main.cpp",
|
||||
"target": "%{MainCppFileName}"
|
||||
},
|
||||
{
|
||||
"source": "main.qml.tpl",
|
||||
"target": "main.qml",
|
||||
"openInEditor": true
|
||||
},
|
||||
{
|
||||
"source": "HomeForm.ui.qml.tpl",
|
||||
"target": "HomeForm.ui.qml"
|
||||
},
|
||||
{
|
||||
"source": "Page1Form.ui.qml.tpl",
|
||||
"target": "Page1Form.ui.qml"
|
||||
},
|
||||
{
|
||||
"source": "Page2Form.ui.qml.tpl",
|
||||
"target": "Page2Form.ui.qml"
|
||||
},
|
||||
{
|
||||
"source": "../qtquickcontrols2.conf",
|
||||
"target": "qtquickcontrols2.conf"
|
||||
},
|
||||
{
|
||||
"source": "qml.qrc"
|
||||
},
|
||||
{
|
||||
"source": "../git.ignore",
|
||||
"target": ".gitignore",
|
||||
"condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2311,7 +2311,7 @@
|
||||
x="0" />
|
||||
</g>
|
||||
<g
|
||||
id="share/qtcreator/templates/wizards/projects/qtquickapplication/icon-stack"
|
||||
id="share/qtcreator/templates/wizards/projects/qtquickapplication/stack/icon"
|
||||
transform="translate(-91,-82)">
|
||||
<use
|
||||
style="display:inline"
|
||||
|
||||
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
Reference in New Issue
Block a user