feat(StatusModal): introduce `hasCloseButton` property

This property can be used to hide the close button, as there are some
modals that shouldn't allow users to "x" modals away.
This commit is contained in:
Pascal Precht 2021-11-30 16:36:58 +01:00 committed by r4bbit.eth
parent 9a400ea45c
commit 2336b6aab1
2 changed files with 4 additions and 1 deletions

View File

@ -18,6 +18,7 @@ QC.Popup {
property alias leftButtons: footerImpl.leftButtons property alias leftButtons: footerImpl.leftButtons
property bool showHeader: true property bool showHeader: true
property bool showFooter: true property bool showFooter: true
property alias hasCloseButton: headerImpl.hasCloseButton
signal editButtonClicked() signal editButtonClicked()
signal headerImageClicked() signal headerImageClicked()

View File

@ -19,6 +19,7 @@ Rectangle {
property alias icon: imageWithTitle.icon property alias icon: imageWithTitle.icon
property bool editable: false property bool editable: false
property alias headerImageEditable: imageWithTitle.headerImageEditable property alias headerImageEditable: imageWithTitle.headerImageEditable
property bool hasCloseButton: true
property Component popupMenu property Component popupMenu
signal editButtonClicked signal editButtonClicked
@ -76,7 +77,7 @@ Rectangle {
Loader { Loader {
id: actionButtonLoader id: actionButtonLoader
objectName: "actionButtonloader" objectName: "actionButtonloader"
anchors.right: closeButton.left anchors.right: closeButton.visible ? closeButton.left : parent.right
anchors.rightMargin: 8 anchors.rightMargin: 8
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 16 anchors.topMargin: 16
@ -96,6 +97,7 @@ Rectangle {
icon.color: Theme.palette.directColor1 icon.color: Theme.palette.directColor1
icon.width: 20 icon.width: 20
icon.height: 20 icon.height: 20
visible: statusModalHeader.hasCloseButton
onClicked: statusModalHeader.close() onClicked: statusModalHeader.close()
} }