Verified Commit 3a1603a4 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

applets/notifications: Pass wheel events of TextArea to ListView

Prevent `TextArea` in SelectableLabel from accepting wheel
events when the notification item is in FullRepresentation,
and pass wheel events to `ListView` in FullRepresentation when the
cursor is over the `TextArea`.

BUG: 443840
FIXED-IN: 5.24
parent 747076d7
Pipeline #104073 passed with stage
in 4 minutes and 36 seconds
......@@ -430,6 +430,7 @@ PlasmaComponents3.Page {
inGroup: model.isInGroup
inHistory: true
listViewParent: list
applicationName: model.applicationName
applicationIconSource: model.applicationIconName
......
......@@ -27,6 +27,7 @@ ColumnLayout {
property bool inGroup: false
property bool inHistory: false
property ListView listViewParent: null
property alias applicationIconSource: notificationHeading.applicationIconSource
property alias applicationName: notificationHeading.applicationName
......@@ -241,6 +242,7 @@ ColumnLayout {
SelectableLabel {
id: bodyLabel
listViewParent: notificationItem.listViewParent
// FIXME how to assign this via State? target: bodyLabel.Layout doesn't work and just assigning the property doesn't either
Layout.alignment: notificationItem.inGroup ? Qt.AlignTop : Qt.AlignVCenter
Layout.fillWidth: true
......
......@@ -23,6 +23,7 @@ PlasmaComponents3.ScrollView {
property int cursorShape
property QtObject contextMenu: null
property ListView listViewParent: null
signal clicked(var mouse)
signal linkActivated(string link)
......@@ -87,6 +88,18 @@ PlasmaComponents3.ScrollView {
});
contextMenu.open(mouse.x, mouse.y);
}
// Pass wheel events to ListView to make scrolling work in FullRepresentation.
onWheel: {
if (bodyTextContainer.listViewParent
&& ((wheel.angleDelta.y > 0 && !bodyTextContainer.listViewParent.atYBeginning)
|| (wheel.angleDelta.y < 0 && !bodyTextContainer.listViewParent.atYEnd))) {
bodyTextContainer.listViewParent.contentY -= wheel.angleDelta.y;
wheel.accepted = true;
} else {
wheel.accepted = false;
}
}
}
}
......
Markdown is supported
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