Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Examples] add new dialogs type examples
  • Loading branch information
neochapay committed Apr 10, 2018
1 parent fa5841a commit 8cbb1f4
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 13 deletions.
Expand Up @@ -49,19 +49,51 @@ Page {
fillMode: Image.PreserveAspectCrop
}

ListModel {
id: animalsModel
ListElement { name: "Ant"; }
ListElement { name: "Flea"; }
ListElement { name: "Parrot"; }
ListElement { name: "Guinea pig"; }
ListElement { name: "Rat"; }
ListElement { name: "Butterfly"; }
ListElement { name: "Dog"; }
ListElement { name: "Cat"; }
ListElement { name: "Pony"; }
ListElement { name: "Koala"; }
ListElement { name: "Horse"; }
ListElement { name: "Tiger"; }
ListElement { name: "Giraffe"; }
ListElement { name: "Elephant"; }
ListElement { name: "Whale"; }
}

function hideButton(){
standartButton.visible = false
inlineButton.visible = false
simpleButton.visible = false
selectionButton.visible = false
}

function showButton(){
standartButton.visible = true
inlineButton.visible = true
simpleButton.visible = true
selectionButton.visible = true
}

Button {
id: standartButton
anchors{
top: parent.top
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Standart dialog")
text: qsTr("Standart query dialog")
onClicked: {
deleteDialog.inline = false
deleteDialog.visible = true
standartButton.visible = false
inlineButton.visible = false
deleteDialog.open()
hideButton();
}
}

Expand All @@ -72,15 +104,72 @@ Page {
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Inline dialog")
text: qsTr("Inline query dialog")
onClicked: {
deleteDialog.inline = true
deleteDialog.visible = true
standartButton.visible = false
inlineButton.visible = false
deleteDialog.open()
hideButton();
}
}

Button {
id: simpleButton
anchors{
top: inlineButton.bottom
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Simple dialog")
onClicked: {
hideButton();
simpleDialog.open();
}
}

Button {
id: selectionButton
anchors{
top: inlineButton.bottom
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Selection dialog")
onClicked: {
hideButton();
selectionDialog.open();
}
}

Dialog{
id: simpleDialog
acceptText: qsTr("Ok")
headingText: qsTr("Simple dialog")
subLabelText: qsTr("Simple diaolg is open")

inline: false

icon: "image://theme/exclamation-triangle"

onAccepted: {
showButton();
simpleDialog.close();
}
}

SelectionDialog{
id: selectionDialog
visible: false

cancelText: qsTr("Cancel")
acceptText: qsTr("Ok")
headingText: qsTr("Select you favorite animal?")
subLabelText: qsTr("")

model: animalsModel

onSelectedIndexChanged: selectionDialog.close()
}

QueryDialog {
id: deleteDialog
visible: false
Expand All @@ -99,11 +188,11 @@ Page {
result.text = qsTr("User canceled")
}
onSelected: {
standartButton.visible = true
inlineButton.visible = true
visible = false
showButton();
deleteDialog.close()
}
}

Label {
id: result
anchors.centerIn: parent
Expand Down
4 changes: 2 additions & 2 deletions examples/touch/glacier-components.qml
Expand Up @@ -118,8 +118,8 @@ ApplicationWindow {
page: "content/ButtonRowPage.qml"
}
ListElement {
title: "Query Dialog"
page: "content/QueryDialogPage.qml"
title: "Dialogs"
page: "content/DialogsPage.qml"
}
ListElement {
title: "Icons"
Expand Down

0 comments on commit 8cbb1f4

Please sign in to comment.