mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
plugins: give popout customizable header actions
This commit is contained in:
@@ -9,6 +9,7 @@ Column {
|
|||||||
property string detailsText: ""
|
property string detailsText: ""
|
||||||
property bool showCloseButton: false
|
property bool showCloseButton: false
|
||||||
property var closePopout: null
|
property var closePopout: null
|
||||||
|
property alias headerActions: headerActionsLoader.sourceComponent
|
||||||
|
|
||||||
readonly property int headerHeight: popoutHeader.visible ? popoutHeader.height : 0
|
readonly property int headerHeight: popoutHeader.visible ? popoutHeader.height : 0
|
||||||
readonly property int detailsHeight: popoutDetails.visible ? popoutDetails.implicitHeight : 0
|
readonly property int detailsHeight: popoutDetails.visible ? popoutDetails.implicitHeight : 0
|
||||||
@@ -31,31 +32,40 @@ Column {
|
|||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Row {
|
||||||
id: closeButton
|
|
||||||
width: 32
|
|
||||||
height: 32
|
|
||||||
radius: 16
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: closeArea.containsMouse ? Theme.errorHover : "transparent"
|
spacing: Theme.spacingXS
|
||||||
visible: root.showCloseButton
|
|
||||||
|
|
||||||
DankIcon {
|
Loader {
|
||||||
anchors.centerIn: parent
|
id: headerActionsLoader
|
||||||
name: "close"
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
size: Theme.iconSize - 4
|
|
||||||
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
Rectangle {
|
||||||
id: closeArea
|
id: closeButton
|
||||||
anchors.fill: parent
|
width: 32
|
||||||
hoverEnabled: true
|
height: 32
|
||||||
cursorShape: Qt.PointingHandCursor
|
radius: 16
|
||||||
onPressed: {
|
color: closeArea.containsMouse ? Theme.errorHover : "transparent"
|
||||||
if (root.closePopout) {
|
visible: root.showCloseButton
|
||||||
root.closePopout();
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: "close"
|
||||||
|
size: Theme.iconSize - 4
|
||||||
|
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: closeArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onPressed: {
|
||||||
|
if (root.closePopout) {
|
||||||
|
root.closePopout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user