Commit caad921a authored by Nate Graham's avatar Nate Graham
Browse files

applet: re-arrange CompactRepresentation's MouseArea and Icon

With the MouseArea on top, the whole area accepts events in the expanded
view, so you can scroll anywhere to change the volume, not just over the
icon.

BUG: 426646
FIXED-IN: 5.24
parent 0436437c
Pipeline #122054 passed with stage
in 1 minute and 10 seconds
......@@ -300,46 +300,44 @@ Item {
id: paCardModel
}
Plasmoid.compactRepresentation: PlasmaCore.IconItem {
source: plasmoid.icon
active: mouseArea.containsMouse
colorGroup: PlasmaCore.ColorScope.colorGroup
MouseArea {
id: mouseArea
property int wheelDelta: 0
property bool wasExpanded: false
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
onPressed: {
if (mouse.button == Qt.LeftButton) {
wasExpanded = plasmoid.expanded;
} else if (mouse.button == Qt.MiddleButton) {
muteVolume();
}
Plasmoid.compactRepresentation:MouseArea {
property int wheelDelta: 0
property bool wasExpanded: false
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
onPressed: {
if (mouse.button == Qt.LeftButton) {
wasExpanded = plasmoid.expanded;
} else if (mouse.button == Qt.MiddleButton) {
muteVolume();
}
onClicked: {
if (mouse.button == Qt.LeftButton) {
plasmoid.expanded = !wasExpanded;
}
}
onClicked: {
if (mouse.button == Qt.LeftButton) {
plasmoid.expanded = !wasExpanded;
}
onWheel: {
var delta = wheel.angleDelta.y || wheel.angleDelta.x;
wheelDelta += delta;
// Magic number 120 for common "one click"
// See: https://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop
while (wheelDelta >= 120) {
wheelDelta -= 120;
increaseVolume();
}
while (wheelDelta <= -120) {
wheelDelta += 120;
decreaseVolume();
}
}
onWheel: {
var delta = wheel.angleDelta.y || wheel.angleDelta.x;
wheelDelta += delta;
// Magic number 120 for common "one click"
// See: https://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop
while (wheelDelta >= 120) {
wheelDelta -= 120;
increaseVolume();
}
while (wheelDelta <= -120) {
wheelDelta += 120;
decreaseVolume();
}
}
PlasmaCore.IconItem {
anchors.fill: parent
source: plasmoid.icon
active: parent.containsMouse
colorGroup: PlasmaCore.ColorScope.colorGroup
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment