From 5b0bd26795abdf222d0cfd3e5ee3cf8e8b41a9c9 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 31 Jul 2021 11:04:47 +0200 Subject: [PATCH] Fix annoying touch overlap in room list --- resources/qml/MessageView.qml | 4 ++-- resources/qml/RoomList.qml | 43 ++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index b6f2b909..9ba5e2d0 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -212,9 +212,9 @@ ScrollView { // force current read index to update onTriggered: { - if (chat.model) { + if (chat.model) chat.model.setCurrentIndex(chat.model.currentIndex); - } + } interval: 1000 } diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index a2e50fab..695b08f3 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -172,31 +172,38 @@ Page { } ] - TapHandler { - margin: -Nheko.paddingSmall - acceptedButtons: Qt.RightButton - onSingleTapped: { - if (!TimelineManager.isInvite) - roomContextMenu.show(roomId, tags); + // NOTE(Nico): We want to prevent the touch areas from overlapping. For some reason we need to add 1px of padding for that... + Item { + anchors.fill: parent + anchors.margins: 1 + TapHandler { + acceptedButtons: Qt.RightButton + onSingleTapped: { + if (!TimelineManager.isInvite) + roomContextMenu.show(roomId, tags); + + } + gesturePolicy: TapHandler.ReleaseWithinBounds + acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | DeviceType.TouchPad } - gesturePolicy: TapHandler.ReleaseWithinBounds - } - TapHandler { - margin: -Nheko.paddingSmall - onSingleTapped: Rooms.setCurrentRoom(roomId) - onLongPressed: { - if (!isInvite) - roomContextMenu.show(roomId, tags); + TapHandler { + margin: -Nheko.paddingSmall + onSingleTapped: Rooms.setCurrentRoom(roomId) + onLongPressed: { + if (!isInvite) + roomContextMenu.show(roomId, tags); + } } - } - HoverHandler { - id: hovered + HoverHandler { + id: hovered + + acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | DeviceType.TouchPad + } - margin: -Nheko.paddingSmall } RowLayout {