summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-02-14 16:04:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-25 12:55:43 +0100
commitef965e6e64511ca06831071f65968edc7292c253 (patch)
treea339a3e898bb5df32c1b98897c22cb5c04d0c457 /examples
parentf227712732fbd64bdb42ccf1b9b5ba9c2413b2bc (diff)
downloadqtquickcontrols-ef965e6e64511ca06831071f65968edc7292c253.tar.gz
CustomDialogs example: add an example using Calendar
Also the spinbox exmample will accept when the user presses enter. Change-Id: I47765899acfbc435e2409f7a30e54e8f041b6e73 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/dialogs/systemdialogs/CustomDialogs.qml28
1 files changed, 27 insertions, 1 deletions
diff --git a/examples/quick/dialogs/systemdialogs/CustomDialogs.qml b/examples/quick/dialogs/systemdialogs/CustomDialogs.qml
index 2a31147e..389979ef 100644
--- a/examples/quick/dialogs/systemdialogs/CustomDialogs.qml
+++ b/examples/quick/dialogs/systemdialogs/CustomDialogs.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.1
-import QtQuick.Controls 1.1
+import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Window 2.0
@@ -102,6 +102,7 @@ Item {
Layout.alignment: Qt.AlignHCenter
SpinBox {
id: answer
+ onEditingFinished: spinboxDialog.click(StandardButton.Ok)
}
Text {
text: "m/s"
@@ -111,6 +112,25 @@ Item {
}
}
+ Dialog {
+ id: dateDialog
+ modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: customizeTitle.checked ? windowTitleField.text : "Choose a date"
+ onButtonClicked: console.log("clicked button " + clickedButton)
+ onAccepted: {
+ if (clickedButton == StandardButton.Ok)
+ lastChosen.text = "Accepted " + calendar.selectedDate.toLocaleDateString()
+ else
+ lastChosen.text = (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")
+ }
+
+ Calendar {
+ id: calendar
+ width: parent ? parent.width : implicitWidth
+ onDoubleClicked: dateDialog.click(StandardButton.Ok)
+ }
+ }
+
Column {
anchors.fill: parent
anchors.margins: 12
@@ -154,6 +174,7 @@ Item {
buttons = StandardButton.Ok
helloDialog.standardButtons = buttons
spinboxDialog.standardButtons = buttons
+ dateDialog.standardButtons = buttons
updating = false
}
@@ -257,6 +278,11 @@ Item {
anchors.verticalCenter: parent.verticalCenter
onClicked: spinboxDialog.open()
}
+ Button {
+ text: "Date picker"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: dateDialog.open()
+ }
}
}
}