diff options
author | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2014-10-15 16:02:08 +0200 |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2014-10-30 14:16:17 +0100 |
commit | 7a470e97301d2c032b8b30196e0814f379755a47 (patch) | |
tree | 4d60fbf420838caa5a64a3ce1bfdf56b15c71783 /share | |
parent | 44ba5ce3fd8c76ba7c6ede5828fde430a843dcb7 (diff) | |
download | qt-creator-7a470e97301d2c032b8b30196e0814f379755a47.tar.gz |
Updating the .qrc based wizards to use .ui.qml files
Change-Id: I178b9cdbb895ef221d74b9aa282163307550fd13
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'share')
8 files changed, 79 insertions, 27 deletions
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml b/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml new file mode 100644 index 0000000000..2e69644364 --- /dev/null +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/MainForm.ui.qml @@ -0,0 +1,18 @@ +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" + } +} diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml index adf7a67446..4cdb6ce434 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/main.qml @@ -1,20 +1,8 @@ import QtQuick 2.4 -import QtQuick.Window 2.2 -Window { - visible: true - width: 360 - height: 360 - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit(); - } +MainForm { + mouseArea.onClicked: { + Qt.quit(); } - Text { - text: qsTr("Hello World") - anchors.centerIn: parent - } } diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc b/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc index 5f6483ac33..a01bd23c55 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/qml.qrc @@ -1,5 +1,6 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> + <file>mainForm.ui.qml</file> </qresource> </RCC> diff --git a/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml index 7ae7e86f7e..4e0f06de22 100644 --- a/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml +++ b/share/qtcreator/templates/qtquick/qtquick_2_4/template.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <template openeditor="main.qml" priority="BV" - featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.4" + featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.4, QtSupport.Wizards.FeatureQtQuick.UiFiles" qrcdeployment="qrcdeployment.pri" stubversionminor="5"> <displayname>Qt Quick 2.4</displayname> - <description>Creates a deployable Qt Quick 2 application using the QtQuick 2.4 import. Requires Qt 5.4 or newer.</description> + <description>Creates a deployable Qt Quick 2 application that contains a .ui.qml file using the QtQuick 2.4 import. Requires Qt 5.4 or newer.</description> </template> diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml new file mode 100644 index 0000000000..e557debb83 --- /dev/null +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/MainForm.ui.qml @@ -0,0 +1,31 @@ +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") + } + } +} diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml index 69a744993a..f9d19d4379 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/main.qml @@ -1,28 +1,41 @@ import QtQuick 2.4 import QtQuick.Controls 1.3 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 ApplicationWindow { - visible: true + title: qsTr("Hello World") width: 640 height: 480 - title: qsTr("Hello World") menuBar: MenuBar { Menu { - title: qsTr("File") + title: qsTr("&File") MenuItem { text: qsTr("&Open") - onTriggered: console.log("Open action triggered"); + onTriggered: messageDialog.show(qsTr("Open action triggered")); } MenuItem { - text: qsTr("Exit") + text: qsTr("E&xit") onTriggered: Qt.quit(); } } } - Text { - text: qsTr("Hello World") - anchors.centerIn: parent + 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(); + } } } diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc index 5f6483ac33..a01bd23c55 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/qml.qrc @@ -1,5 +1,6 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> + <file>mainForm.ui.qml</file> </qresource> </RCC> diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml index e278d73e82..288bc02c8f 100644 --- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml +++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_3/template.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <template openeditor="main.qml" priority="AW" - featuresRequired="QtSupport.Wizards.FeatureQtQuick.Controls.1.3" + featuresRequired="QtSupport.Wizards.FeatureQtQuick.Controls.1.3, QtSupport.Wizards.FeatureQtQuick.UiFiles" qrcdeployment="qrcdeployment.pri" stubversionminor="1"> <displayname>Qt Quick Controls 1.3</displayname> - <description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.4 or newer.</description> + <description>Creates a deployable Qt Quick 2 application 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> |