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

View File

@@ -128,7 +128,12 @@ QQC2.Control {
TapHandler {
enabled: root.time.toString() !== "Invalid Date"
acceptedButtons: Qt.LeftButton
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
onTapped: RoomManager.maximizeCode(root.author, root.time, root.display, root.componentAttributes.class)
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: root.showMessageMenu()
}

View File

@@ -68,11 +68,13 @@ TimelineDelegate {
TapHandler {
acceptedButtons: Qt.RightButton
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
onTapped: _private.showMessageMenu()
}
TapHandler {
acceptedButtons: Qt.LeftButton
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: _private.showMessageMenu()
}

View File

@@ -69,6 +69,9 @@ ColumnLayout {
});
map.open();
}
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: openMessageContext("")
}
TapHandler {

View File

@@ -90,6 +90,9 @@ ColumnLayout {
});
map.open();
}
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: openMessageContext("")
}
TapHandler {

View File

@@ -323,6 +323,7 @@ TimelineDelegate {
}
TapHandler {
acceptedDevices: PointerDevice.TouchScreen
acceptedButtons: Qt.LeftButton
onLongPressed: _private.showMessageMenu()
}

View File

@@ -55,6 +55,7 @@ QQC2.Control {
TapHandler {
enabled: !quoteText.hoveredLink
acceptedDevices: PointerDevice.TouchScreen
acceptedButtons: Qt.LeftButton
onLongPressed: root.showMessageMenu()
}

View File

@@ -132,6 +132,7 @@ a{
TapHandler {
enabled: !root.hoveredLink
acceptedButtons: Qt.LeftButton
acceptedDevices: PointerDevice.TouchScreen
onLongPressed: root.showMessageMenu()
}
}