From 2336b6aab17766b953f6c8d4d969c1bd9eda9aa2 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Tue, 30 Nov 2021 16:36:58 +0100 Subject: [PATCH] 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. --- src/StatusQ/Popups/StatusModal.qml | 1 + src/StatusQ/Popups/statusModal/StatusModalHeader.qml | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/StatusQ/Popups/StatusModal.qml b/src/StatusQ/Popups/StatusModal.qml index ef1c3a8b..aa0e3ef9 100644 --- a/src/StatusQ/Popups/StatusModal.qml +++ b/src/StatusQ/Popups/StatusModal.qml @@ -18,6 +18,7 @@ QC.Popup { property alias leftButtons: footerImpl.leftButtons property bool showHeader: true property bool showFooter: true + property alias hasCloseButton: headerImpl.hasCloseButton signal editButtonClicked() signal headerImageClicked() diff --git a/src/StatusQ/Popups/statusModal/StatusModalHeader.qml b/src/StatusQ/Popups/statusModal/StatusModalHeader.qml index 21425fb6..e4ba23c3 100644 --- a/src/StatusQ/Popups/statusModal/StatusModalHeader.qml +++ b/src/StatusQ/Popups/statusModal/StatusModalHeader.qml @@ -19,6 +19,7 @@ Rectangle { property alias icon: imageWithTitle.icon property bool editable: false property alias headerImageEditable: imageWithTitle.headerImageEditable + property bool hasCloseButton: true property Component popupMenu signal editButtonClicked @@ -76,7 +77,7 @@ Rectangle { Loader { id: actionButtonLoader objectName: "actionButtonloader" - anchors.right: closeButton.left + anchors.right: closeButton.visible ? closeButton.left : parent.right anchors.rightMargin: 8 anchors.top: parent.top anchors.topMargin: 16 @@ -96,6 +97,7 @@ Rectangle { icon.color: Theme.palette.directColor1 icon.width: 20 icon.height: 20 + visible: statusModalHeader.hasCloseButton onClicked: statusModalHeader.close() }