Fix mouse wheel not working on eventList

This commit is contained in:
miruka 2019-09-06 16:08:16 -04:00
parent d353056db9
commit e1f24657f1
4 changed files with 37 additions and 6 deletions

View File

@ -36,7 +36,6 @@
- Room header descriptions: styled text - Room header descriptions: styled text
- Message selection - Message selection
- Make scroll wheel usable
- Copy to X11 selection - Copy to X11 selection
- Images don't load correctly in TextEdit - Images don't load correctly in TextEdit

View File

@ -24,9 +24,9 @@ ListView {
color: theme.controls.listView.highlight color: theme.controls.listView.highlight
} }
ScrollBar.vertical: ScrollBar { // ScrollBar.vertical: ScrollBar {
visible: listView.interactive || ! listView.enableFlicking // visible: listView.interactive || ! listView.enableFlicking
} // }
add: Transition { add: Transition {
ParallelAnimation { ParallelAnimation {

View File

@ -7,13 +7,27 @@ Row {
id: eventContent id: eventContent
spacing: theme.spacing / 2 spacing: theme.spacing / 2
readonly property string hoveredLink:
nameLabel.hoveredLink || contentLabel.hoveredLink
readonly property string eventText: Utils.processedEventText(model) readonly property string eventText: Utils.processedEventText(model)
readonly property string eventTime: Utils.formatTime(model.date) readonly property string eventTime: Utils.formatTime(model.date)
readonly property int eventTimeSpaces: 2 readonly property int eventTimeSpaces: 2
readonly property string hoveredLink:
nameLabel.hoveredLink || contentLabel.hoveredLink
readonly property int cursorShape:
hoveredLink ? Qt.PointingHandCursor :
nameHover.hovered || contentHover.hovered ? Qt.IBeamCursor :
Qt.ArrowCursor
// Needed because of eventList's MouseArea which steals the
// HSelectableLabel's MouseArea hover events
onCursorShapeChanged: eventList.cursorShape = cursorShape
HoverHandler { id: hover }
Item { Item {
width: hideAvatar ? 0 : 48 width: hideAvatar ? 0 : 48
height: hideAvatar ? 0 : collapseAvatar ? 1 : smallAvatar ? 28 : 48 height: hideAvatar ? 0 : collapseAvatar ? 1 : smallAvatar ? 28 : 48
@ -74,6 +88,8 @@ Row {
function selectAllTextPlus() { function selectAllTextPlus() {
contentLabel.selectAllTextPlus() contentLabel.selectAllTextPlus()
} }
HoverHandler { id: nameHover }
} }
HSelectableLabel { HSelectableLabel {
@ -124,6 +140,7 @@ Row {
contentLabel.updateContainerSelectedTexts() contentLabel.updateContainerSelectedTexts()
} }
HoverHandler { id: contentHover }
} }
} }
} }

View File

@ -92,6 +92,8 @@ Rectangle {
property bool ownEventsOnRight: property bool ownEventsOnRight:
width < theme.chat.eventList.ownEventsOnRightUnderWidth width < theme.chat.eventList.ownEventsOnRightUnderWidth
property alias cursorShape: mouseArea.cursorShape
function canCombine(item, itemAfter) { function canCombine(item, itemAfter) {
if (! item || ! itemAfter) return false if (! item || ! itemAfter) return false
@ -154,6 +156,19 @@ Rectangle {
} }
delegate: EventDelegate {} delegate: EventDelegate {}
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.NoButton
onWheel: Utils.smartVerticalFlick(
eventList,
200 * Qt.styleHints.wheelScrollLines *
(wheel.angleDelta.y < 0 ? 1 : -1),
3
)
}
} }
} }