From 18e96d5c7d17e02589767843235737314306b41b Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 11 Apr 2021 22:24:39 +0200 Subject: Fix some TapHandler focus issues --- resources/qml/Avatar.qml | 1 + resources/qml/MessageView.qml | 1 - resources/qml/QuickSwitcher.qml | 2 +- resources/qml/TimelineRow.qml | 2 ++ resources/qml/TimelineView.qml | 9 +++++---- resources/qml/TopBar.qml | 9 ++++++--- resources/qml/delegates/FileMessage.qml | 1 + resources/qml/delegates/ImageMessage.qml | 6 +++++- resources/qml/delegates/Reply.qml | 2 ++ resources/qml/emoji/EmojiPicker.qml | 13 ++++++------- 10 files changed, 29 insertions(+), 17 deletions(-) diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml index 07e68e10..108bb768 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml @@ -61,6 +61,7 @@ Rectangle { } layer.effect: OpacityMask { + cached: true maskSource: Rectangle { anchors.fill: parent diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index d8230151..b9606564 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -15,7 +15,6 @@ ScrollView { clip: false palette: colors padding: 8 - ScrollBar.horizontal.visible: false ListView { diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml index 9f4691b6..166c788d 100644 --- a/resources/qml/QuickSwitcher.qml +++ b/resources/qml/QuickSwitcher.qml @@ -22,7 +22,7 @@ Popup { palette: colors onOpened: { completerPopup.open(); - roomTextInput.forceActiveFocus(); + roomTextInput.forceActiveFocus(); } onClosed: { completerPopup.close(); diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index a66b994a..321be5b2 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -29,11 +29,13 @@ Item { TapHandler { acceptedButtons: Qt.RightButton onSingleTapped: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable) + gesturePolicy: TapHandler.ReleaseWithinBounds } TapHandler { onLongPressed: messageContextMenu.show(model.id, model.type, model.isEncrypted, model.isEditable) onDoubleTapped: chat.model.reply = model.id + gesturePolicy: TapHandler.ReleaseWithinBounds } RowLayout { diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index fca5c366..481561d2 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -94,21 +94,22 @@ Page { property string eventId property int eventType property bool isEncrypted - property bool isEditable + property bool isEditable function show(eventId_, eventType_, isEncrypted_, isEditable_, showAt_) { eventId = eventId_; eventType = eventType_; isEncrypted = isEncrypted_; - isEditable = isEditable_; + isEditable = isEditable_; if (showAt_) open(showAt_); else open(); } - Platform.MenuItem { - id: reactionOption + Platform.MenuItem { + id: reactionOption + text: qsTr("React") onTriggered: emojiPopup.show(null, function(emoji) { TimelineManager.queueReactionMessage(messageContextMenu.eventId, emoji); diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index a3e398e6..188f456b 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -19,7 +19,11 @@ Rectangle { color: colors.window TapHandler { - onSingleTapped: TimelineManager.timeline.openRoomSettings() + onSingleTapped: { + TimelineManager.timeline.openRoomSettings(); + eventPoint.accepted = true; + } + gesturePolicy: TapHandler.ReleaseWithinBounds } GridLayout { @@ -57,7 +61,7 @@ Rectangle { height: avatarSize url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" displayName: room ? room.roomName : qsTr("No room selected") - onClicked: TimelineManager.openRoomSettings() + onClicked: TimelineManager.timeline.openRoomSettings() } Label { @@ -69,7 +73,6 @@ Rectangle { text: room ? room.roomName : qsTr("No room selected") maximumLineCount: 1 elide: Text.ElideRight - } MatrixText { diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml index 285a9a33..e883ddbb 100644 --- a/resources/qml/delegates/FileMessage.qml +++ b/resources/qml/delegates/FileMessage.qml @@ -35,6 +35,7 @@ Item { TapHandler { onSingleTapped: TimelineManager.timeline.saveMedia(model.data.id) + gesturePolicy: TapHandler.ReleaseWithinBounds } CursorShape { diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml index 0521258e..0c863c86 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml @@ -38,7 +38,11 @@ Item { TapHandler { enabled: model.data.type == MtxEvent.ImageMessage && img.status == Image.Ready - onSingleTapped: TimelineManager.openImageOverlay(model.data.url, model.data.id) + onSingleTapped: { + TimelineManager.openImageOverlay(model.data.url, model.data.id); + eventPoint.accepted = true; + } + gesturePolicy: TapHandler.ReleaseWithinBounds } HoverHandler { diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml index 6763b71b..dc2124d5 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml @@ -19,6 +19,7 @@ Item { TapHandler { onSingleTapped: chat.positionViewAtIndex(chat.model.idToIndex(modelData.id), ListView.Contain) + gesturePolicy: TapHandler.ReleaseWithinBounds } CursorShape { @@ -51,6 +52,7 @@ Item { TapHandler { onSingleTapped: chat.model.openUserProfile(reply.modelData.userId) + gesturePolicy: TapHandler.ReleaseWithinBounds } } diff --git a/resources/qml/emoji/EmojiPicker.qml b/resources/qml/emoji/EmojiPicker.qml index 529a81c1..97dc0255 100644 --- a/resources/qml/emoji/EmojiPicker.qml +++ b/resources/qml/emoji/EmojiPicker.qml @@ -35,7 +35,6 @@ Menu { modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - height: columnView.implicitHeight + 4 ColumnLayout { @@ -44,17 +43,17 @@ Menu { spacing: 0 anchors.leftMargin: 3 anchors.rightMargin: 3 - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.topMargin: 2 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: 2 // emoji grid GridView { id: gridView - Layout.preferredHeight: cellHeight * 5 - Layout.preferredWidth: 7 * 52 + 20 + Layout.preferredHeight: cellHeight * 5 + Layout.preferredWidth: 7 * 52 + 20 Layout.leftMargin: 4 cellWidth: 52 cellHeight: 52 -- cgit 1.4.1