aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/gallery/gallery.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quickcontrols2/gallery/gallery.qml')
-rw-r--r--examples/quickcontrols2/gallery/gallery.qml88
1 files changed, 26 insertions, 62 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml
index aadbcdec..97985a6d 100644
--- a/examples/quickcontrols2/gallery/gallery.qml
+++ b/examples/quickcontrols2/gallery/gallery.qml
@@ -40,9 +40,9 @@
import QtQuick 2.6
import QtQuick.Layouts 1.3
-import QtQuick.Controls 2.0
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls 2.1
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Universal 2.1
import Qt.labs.settings 1.0
ApplicationWindow {
@@ -105,7 +105,7 @@ ApplicationWindow {
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
- source: "qrc:/images/menu.png"
+ source: "images/menu.png"
}
onClicked: optionsMenu.open()
@@ -116,7 +116,7 @@ ApplicationWindow {
MenuItem {
text: "Settings"
- onTriggered: settingsPopup.open()
+ onTriggered: settingsDialog.open()
}
MenuItem {
text: "About"
@@ -157,13 +157,11 @@ ApplicationWindow {
ListElement { title: "CheckBox"; source: "qrc:/pages/CheckBoxPage.qml" }
ListElement { title: "ComboBox"; source: "qrc:/pages/ComboBoxPage.qml" }
ListElement { title: "Dial"; source: "qrc:/pages/DialPage.qml" }
+ ListElement { title: "Dialog"; source: "qrc:/pages/DialogPage.qml" }
ListElement { title: "Delegates"; source: "qrc:/pages/DelegatePage.qml" }
- ListElement { title: "Drawer"; source: "qrc:/pages/DrawerPage.qml" }
ListElement { title: "Frame"; source: "qrc:/pages/FramePage.qml" }
ListElement { title: "GroupBox"; source: "qrc:/pages/GroupBoxPage.qml" }
- ListElement { title: "Menu"; source: "qrc:/pages/MenuPage.qml" }
ListElement { title: "PageIndicator"; source: "qrc:/pages/PageIndicatorPage.qml" }
- ListElement { title: "Popup"; source: "qrc:/pages/PopupPage.qml" }
ListElement { title: "ProgressBar"; source: "qrc:/pages/ProgressBarPage.qml" }
ListElement { title: "RadioButton"; source: "qrc:/pages/RadioButtonPage.qml" }
ListElement { title: "RangeSlider"; source: "qrc:/pages/RangeSliderPage.qml" }
@@ -199,7 +197,7 @@ ApplicationWindow {
anchors.centerIn: parent
anchors.verticalCenterOffset: -50
fillMode: Image.PreserveAspectFit
- source: "qrc:/images/qt-logo.png"
+ source: "images/qt-logo.png"
}
Label {
@@ -216,31 +214,36 @@ ApplicationWindow {
Image {
id: arrow
- source: "qrc:/images/arrow.png"
+ source: "images/arrow.png"
anchors.left: parent.left
anchors.bottom: parent.bottom
}
}
}
- Popup {
- id: settingsPopup
- x: (window.width - width) / 2
- y: window.height / 6
- width: Math.min(window.width, window.height) / 3 * 2
- height: settingsColumn.implicitHeight + topPadding + bottomPadding
+ Dialog {
+ id: settingsDialog
+ x: Math.round((window.width - width) / 2)
+ y: Math.round(window.height / 6)
+ width: Math.round(Math.min(window.width, window.height) / 3 * 2)
modal: true
focus: true
+ title: "Settings"
+
+ standardButtons: Dialog.Ok | Dialog.Cancel
+ onAccepted: {
+ settings.style = styleBox.displayText
+ settingsDialog.close()
+ }
+ onRejected: {
+ styleBox.currentIndex = styleBox.styleIndex
+ settingsDialog.close()
+ }
contentItem: ColumnLayout {
id: settingsColumn
spacing: 20
- Label {
- text: "Settings"
- font.bold: true
- }
-
RowLayout {
spacing: 10
@@ -270,48 +273,14 @@ ApplicationWindow {
Layout.fillWidth: true
Layout.fillHeight: true
}
-
- RowLayout {
- spacing: 10
-
- Button {
- id: okButton
- text: "Ok"
- onClicked: {
- settings.style = styleBox.displayText
- settingsPopup.close()
- }
-
- Material.foreground: Material.primary
- Material.background: "transparent"
- Material.elevation: 0
-
- Layout.preferredWidth: 0
- Layout.fillWidth: true
- }
-
- Button {
- id: cancelButton
- text: "Cancel"
- onClicked: {
- styleBox.currentIndex = styleBox.styleIndex
- settingsPopup.close()
- }
-
- Material.background: "transparent"
- Material.elevation: 0
-
- Layout.preferredWidth: 0
- Layout.fillWidth: true
- }
- }
}
}
- Popup {
+ Dialog {
id: aboutDialog
modal: true
focus: true
+ title: "About"
x: (window.width - width) / 2
y: window.height / 6
width: Math.min(window.width, window.height) / 3 * 2
@@ -322,11 +291,6 @@ ApplicationWindow {
spacing: 20
Label {
- text: "About"
- font.bold: true
- }
-
- Label {
width: aboutDialog.availableWidth
text: "The Qt Quick Controls 2 module delivers the next generation user interface controls based on Qt Quick."
wrapMode: Label.Wrap