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
- Message selection
- Make scroll wheel usable
- Copy to X11 selection
- Images don't load correctly in TextEdit

View File

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

View File

@ -7,13 +7,27 @@ Row {
id: eventContent
spacing: theme.spacing / 2
readonly property string hoveredLink:
nameLabel.hoveredLink || contentLabel.hoveredLink
readonly property string eventText: Utils.processedEventText(model)
readonly property string eventTime: Utils.formatTime(model.date)
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 {
width: hideAvatar ? 0 : 48
height: hideAvatar ? 0 : collapseAvatar ? 1 : smallAvatar ? 28 : 48
@ -74,6 +88,8 @@ Row {
function selectAllTextPlus() {
contentLabel.selectAllTextPlus()
}
HoverHandler { id: nameHover }
}
HSelectableLabel {
@ -124,6 +140,7 @@ Row {
contentLabel.updateContainerSelectedTexts()
}
HoverHandler { id: contentHover }
}
}
}

View File

@ -92,6 +92,8 @@ Rectangle {
property bool ownEventsOnRight:
width < theme.chat.eventList.ownEventsOnRightUnderWidth
property alias cursorShape: mouseArea.cursorShape
function canCombine(item, itemAfter) {
if (! item || ! itemAfter) return false
@ -154,6 +156,19 @@ Rectangle {
}
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
)
}
}
}