Commit 737b7bec authored by Shawn Rutledge's avatar Shawn Rutledge
Browse files

Dialogs: buttonless fully-filled dialog example


The default property "contentItem" is normally the parent of the
added content, but you can set the content directly into the property
to avoid having any buttons or margins.

Task-number: QTBUG-38056
Change-Id: Ie0e96969b3e35f079b29a9f3f57eaaf16236d4c1
Reviewed-by: default avatarLiang Qi <liang.qi@digia.com>
Showing with 23 additions and 1 deletion
...@@ -131,6 +131,24 @@ Item { ...@@ -131,6 +131,24 @@ Item {
} }
} }
Dialog {
id: filledDialog
modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal
title: customizeTitle.checked ? windowTitleField.text : "Customized content"
contentItem: Rectangle {
color: "lightskyblue"
implicitWidth: 400
implicitHeight: 100
Text {
text: "Hello blue sky!"
color: "navy"
anchors.centerIn: parent
}
focus: true
Keys.onEscapePressed: filledDialog.close()
}
}
Column { Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: 12 anchors.margins: 12
...@@ -143,7 +161,6 @@ Item { ...@@ -143,7 +161,6 @@ Item {
CheckBox { CheckBox {
id: dialogModal id: dialogModal
text: "Modal" text: "Modal"
checked: true
Binding on checked { value: helloDialog.modality != Qt.NonModal } Binding on checked { value: helloDialog.modality != Qt.NonModal }
} }
CheckBox { CheckBox {
...@@ -283,6 +300,11 @@ Item { ...@@ -283,6 +300,11 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: dateDialog.open() onClicked: dateDialog.open()
} }
Button {
text: "Buttonless marginless dialog"
anchors.verticalCenter: parent.verticalCenter
onClicked: filledDialog.open()
}
} }
} }
} }
Supports Markdown
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