Commit 8cbb1f48 authored by Chupligin Sergey's avatar Chupligin Sergey Committed by Sergey Chupligin

[Examples] add new dialogs type examples

parent fa5841ad
...@@ -49,6 +49,39 @@ Page { ...@@ -49,6 +49,39 @@ Page {
fillMode: Image.PreserveAspectCrop 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 { Button {
id: standartButton id: standartButton
anchors{ anchors{
...@@ -56,12 +89,11 @@ Page { ...@@ -56,12 +89,11 @@ Page {
margins: 20 margins: 20
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
text: qsTr("Standart dialog") text: qsTr("Standart query dialog")
onClicked: { onClicked: {
deleteDialog.inline = false deleteDialog.inline = false
deleteDialog.visible = true deleteDialog.open()
standartButton.visible = false hideButton();
inlineButton.visible = false
} }
} }
...@@ -72,15 +104,72 @@ Page { ...@@ -72,15 +104,72 @@ Page {
margins: 20 margins: 20
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
text: qsTr("Inline dialog") text: qsTr("Inline query dialog")
onClicked: { onClicked: {
deleteDialog.inline = true deleteDialog.inline = true
deleteDialog.visible = true deleteDialog.open()
standartButton.visible = false hideButton();
inlineButton.visible = false }
}
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 { QueryDialog {
id: deleteDialog id: deleteDialog
visible: false visible: false
...@@ -99,11 +188,11 @@ Page { ...@@ -99,11 +188,11 @@ Page {
result.text = qsTr("User canceled") result.text = qsTr("User canceled")
} }
onSelected: { onSelected: {
standartButton.visible = true showButton();
inlineButton.visible = true deleteDialog.close()
visible = false
} }
} }
Label { Label {
id: result id: result
anchors.centerIn: parent anchors.centerIn: parent
......
...@@ -118,8 +118,8 @@ ApplicationWindow { ...@@ -118,8 +118,8 @@ ApplicationWindow {
page: "content/ButtonRowPage.qml" page: "content/ButtonRowPage.qml"
} }
ListElement { ListElement {
title: "Query Dialog" title: "Dialogs"
page: "content/QueryDialogPage.qml" page: "content/DialogsPage.qml"
} }
ListElement { ListElement {
title: "Icons" title: "Icons"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment