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: false
- property string m_title
- property string m_description
- property string m_date
- function dialogCanAccept() {
- if (date.value.length != 0 &&
- title.text.length != 0 &&
- description.text.length != 0) {
- inputDialog.canAccept = true
- } else {
- inputDialog.canAccept = false
- }
- }
- 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")
- onTextChanged: dialogCanAccept()
- }
- TextField {
- id: description
- width: inputDialog.width
- placeholderText: qsTr("Enter description")
- onTextChanged: dialogCanAccept()
- }
- }
- 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