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
wilder-5.24
Fushan Wen 4 years ago
parent 747076d712
commit 3a1603a4e1
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 1
      applets/notifications/package/contents/ui/FullRepresentation.qml
  2. 2
      applets/notifications/package/contents/ui/NotificationItem.qml
  3. 13
      applets/notifications/package/contents/ui/SelectableLabel.qml

@ -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;
}
}
}
}

Loading…
Cancel
Save