Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import Sailfish.Silica 1.0
- Dialog {
- id: inputDialog
- canAccept: !title.errorHighlight && !description.errorHighlight
- property string m_title
- property string m_description
- property string m_date
- Column {
- anchors.fill: parent
- DialogHeader {}
- ValueButton {
- id: date
- label: "Date:"
- value: new Date()
- description: "Default value: ..."
- onClicked: {
- var dialog = pageStack.push(pickerComponent, {
- date: new Date()
- })
- dialog.accepted.connect(function() {
- date.value = dialog.dateText
- })
- }
- Component {
- id: pickerComponent
- DatePickerDialog {}
- }
- }
- TextField {
- id: title
- width: inputDialog.width
- placeholderText: qsTr("Enter title")
- description: qsTr("Title")
- errorHighlight: text.length == 0
- EnterKey.enabled: text || inputMethodComposing
- EnterKey.iconSource: "image://theme/icon-m-enter-next"
- EnterKey.onClicked: description.focus = true
- }
- TextField {
- id: description
- width: inputDialog.width
- placeholderText: qsTr("Enter description")
- description: qsTr("Description")
- errorHighlight: text.length == 0
- EnterKey.enabled: text || inputMethodComposing
- EnterKey.highlighted: !errorHighlight
- EnterKey.iconSource: "image://theme/icon-m-enter-next"
- EnterKey.onClicked: {
- if (!inputDialog.canAccept)
- title.focus = true
- else
- inputDialog.accept()
- }
- }
- }
- onDone: {
- if (result == DialogResult.Accepted) {
- m_title = title.text
- console.log(m_title)
- m_description = description.text
- console.log(m_description)
- m_date = date.value
- console.log(m_date)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement