dock: previews

This commit is contained in:
end-4
2025-05-30 11:27:57 +02:00
parent 198bcc6a3a
commit 3cd8865a50
6 changed files with 267 additions and 42 deletions
@@ -19,6 +19,7 @@ Button {
property real buttonRadius: Appearance?.rounding?.small ?? 4
property real buttonRadiusPressed: buttonRadius
property var altAction
property var middleClickAction
property bool bounce: true
property real baseWidth: contentItem.implicitWidth + padding * 2
property real baseHeight: contentItem.implicitHeight + padding * 2
@@ -67,9 +68,13 @@ Button {
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onPressed: (event) => {
if(event.button === Qt.RightButton) {
if (event.button === Qt.MiddleButton) {
if (root.middleClickAction) root.middleClickAction();
return;
}
if (event.button === Qt.RightButton) {
if (root.altAction) root.altAction();
return;
}
@@ -21,6 +21,7 @@ Button {
property int rippleDuration: 1200
property bool rippleEnabled: true
property var altAction
property var middleClickAction
property color colBackground: ColorUtils.transparentize(Appearance?.colors.colLayer1Hover, 1) || "transparent"
property color colBackgroundHover: Appearance?.colors.colLayer1Hover ?? "#E5DFED"
@@ -58,12 +59,16 @@ Button {
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onPressed: (event) => {
if(event.button === Qt.RightButton) {
if (root.altAction) root.altAction();
return;
}
if(event.button === Qt.MiddleButton) {
if (root.middleClickAction) root.middleClickAction();
return;
}
root.down = true
if (!root.rippleEnabled) return;
const {x,y} = event