Don't allow long-pressing on non-touchscreen devices

It isn't the right kind of interaction on a computer with a mouse or
trackpad, it should be relegated to touchscreen only. This should
hopefully cover everything from room list delegates to messages.
This commit is contained in:
Joshua Goins
2025-02-21 16:07:31 -05:00
parent 94fdf777cb
commit 88d684b6c1
9 changed files with 27 additions and 4 deletions

View File

@@ -34,9 +34,8 @@ Delegates.RoundedItemDelegate {
Keys.onSpacePressed: selected()
Keys.onEnterPressed: selected()
onPressAndHold: root.contextMenuRequested()
TapHandler {
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
acceptedButtons: Qt.RightButton | Qt.LeftButton
onTapped: (eventPoint, button) => {
if (button === Qt.RightButton) {
@@ -47,6 +46,11 @@ Delegates.RoundedItemDelegate {
}
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: root.contextMenuRequested()
}
contentItem: AvatarNotification {
id: avatarNotification
source: root.source

View File

@@ -42,8 +42,6 @@ Delegates.RoundedItemDelegate {
}
}
onPressAndHold: createRoomListContextMenu()
Keys.onSpacePressed: clicked()
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
@@ -54,6 +52,11 @@ Delegates.RoundedItemDelegate {
onTapped: (eventPoint, button) => root.createRoomListContextMenu()
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: root.createRoomListContextMenu()
}
contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing