Commit 7ef8ba08 authored by Alessandro Portale's avatar Alessandro Portale

Application wizard for Qt.labs.control based applications

Let's make it easier to create applications with Qt labs controls. This
creates a tabbed navigation style. We can add options to the wizard to
create drill-down and other common navigation styles. Also an option
for the controls style (material, universal, etc.). And perhaps a
checkbox to include the virtual keyboard.

Change-Id: I9672ab12aa616e7ce08e90eb244fad525e5ab2b2
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
parent 83e18c12
import QtQuick %{QtQuickVersion}
Page1Form {
button1.onClicked: {
console.log("Button 1 clicked.");
}
button2.onClicked: {
console.log("Button 2 clicked.");
}
}
import QtQuick %{QtQuickVersion}
import Qt.labs.controls %{QtLabsControlsVersion}
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")
}
}
}
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)
%{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();
}
import QtQuick %{QtQuickVersion}
import QtQuick.Layouts %{QtQuickLayoutsVersion}
import Qt.labs.controls %{QtLabsControlsVersion}
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")
}
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Page1.qml</file>
<file>Page1Form.ui.qml</file>
</qresource>
</RCC>
{
"version": 1,
"supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
"id": "W.QtLabsControlsApplication",
"category": "F.Application",
"trDescription": "Creates a deployable Qt Quick 2 application using Qt Labs Controls.",
"trDisplayName": "Qt Labs Controls Application",
"trDisplayCategory": "Application",
"icon": "../qtquickapplication/qml_wizard.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQt.labs.controls.1.0" ],
"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.6" },
{ "key": "QtLabsControlsVersion", "value": "1.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'}"
}
]
}
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment