replace MouseArea with TapHandler in panel content, fix chevron double-fire with idempotent expand

This commit is contained in:
Damocles 2026-04-13 21:49:43 +02:00
parent 5eb6ce6d96
commit cce695a8c6
2 changed files with 25 additions and 28 deletions

View file

@ -304,11 +304,10 @@ M.BarSection {
font.pixelSize: M.Theme.fontSize + 4
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
TapHandler {
cursorShape: Qt.PointingHandCursor
enabled: root.player?.canGoPrevious ?? false
onClicked: root.player.previous()
onTapped: root.player.previous()
}
}
@ -318,10 +317,9 @@ M.BarSection {
font.pixelSize: M.Theme.fontSize + 8
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
TapHandler {
cursorShape: Qt.PointingHandCursor
onClicked: root.player?.togglePlaying()
onTapped: root.player?.togglePlaying()
}
}
@ -331,11 +329,10 @@ M.BarSection {
font.pixelSize: M.Theme.fontSize + 4
font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
TapHandler {
cursorShape: Qt.PointingHandCursor
enabled: root.player?.canGoNext ?? false
onClicked: root.player.next()
onTapped: root.player.next()
}
}
}
@ -359,7 +356,7 @@ M.BarSection {
width: _pLabel.implicitWidth + 12
height: 18
radius: 9
color: _active ? M.Theme.base02 : (pArea.containsMouse ? M.Theme.base02 : "transparent")
color: _active ? M.Theme.base02 : (pHover.hovered ? M.Theme.base02 : "transparent")
border.color: _active ? root.accentColor : M.Theme.base03
border.width: _active ? 1 : 0
anchors.verticalCenter: parent.verticalCenter
@ -374,12 +371,13 @@ M.BarSection {
font.bold: _active
}
MouseArea {
id: pArea
anchors.fill: parent
hoverEnabled: true
HoverHandler {
id: pHover
cursorShape: Qt.PointingHandCursor
onClicked: root._playerIdx = index
}
TapHandler {
onTapped: root._playerIdx = index
}
}
}

View file

@ -132,10 +132,9 @@ M.BarSection {
font.pixelSize: M.Theme.fontSize + 2
font.family: M.Theme.iconFontFamily
MouseArea {
anchors.fill: parent
TapHandler {
cursorShape: Qt.PointingHandCursor
onClicked: if (root.sink?.audio)
onTapped: if (root.sink?.audio)
root.sink.audio.muted = !root.sink.audio.muted
}
}
@ -230,7 +229,7 @@ M.BarSection {
TapHandler {
cursorShape: Qt.PointingHandCursor
onTapped: root._expanded = !root._expanded
onTapped: root._expanded = true
}
}
@ -285,7 +284,7 @@ M.BarSection {
anchors.fill: parent
anchors.leftMargin: 4
anchors.rightMargin: 4
color: deviceArea.containsMouse ? M.Theme.base02 : "transparent"
color: deviceHover.hovered ? M.Theme.base02 : "transparent"
radius: M.Theme.radius
}
@ -303,12 +302,13 @@ M.BarSection {
elide: Text.ElideRight
}
MouseArea {
id: deviceArea
anchors.fill: parent
hoverEnabled: true
HoverHandler {
id: deviceHover
cursorShape: Qt.PointingHandCursor
onClicked: Pipewire.preferredDefaultAudioSink = modelData
}
TapHandler {
onTapped: Pipewire.preferredDefaultAudioSink = modelData
}
}
}
@ -365,10 +365,9 @@ M.BarSection {
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.iconFontFamily
MouseArea {
anchors.fill: parent
TapHandler {
cursorShape: Qt.PointingHandCursor
onClicked: if (streamEntry.modelData.audio)
onTapped: if (streamEntry.modelData.audio)
streamEntry.modelData.audio.muted = !streamEntry.modelData.audio.muted
}
}