From 5523460f4e47dcfbbe0da7bf540271a76a50f109 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 8 Oct 2024 23:35:13 +0200 Subject: [PATCH] Fix menu positions --- resources/qml/CommunitiesList.qml | 9 +++++---- resources/qml/MessageView.qml | 4 ++-- resources/qml/RoomList.qml | 22 ++++++++++++++------- resources/qml/TopBar.qml | 2 +- resources/qml/components/SpaceMenuLevel.qml | 2 +- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/resources/qml/CommunitiesList.qml b/resources/qml/CommunitiesList.qml index 797a72b1..2b0be72c 100644 --- a/resources/qml/CommunitiesList.qml +++ b/resources/qml/CommunitiesList.qml @@ -100,17 +100,18 @@ Page { ] onClicked: Communities.setCurrentTagId(model.id) - onPressAndHold: communityContextMenu.show(model.id, model.hidden, model.muted) + onPressAndHold: communityContextMenu.show(communityItem, model.id, model.hidden, model.muted) Item { anchors.fill: parent TapHandler { + id: rth acceptedButtons: Qt.RightButton acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad gesturePolicy: TapHandler.ReleaseWithinBounds - onSingleTapped: communityContextMenu.show(model.id, model.hidden, model.muted) + onSingleTapped: communityContextMenu.show(rth, model.id, model.hidden, model.muted) } } RowLayout { @@ -201,11 +202,11 @@ Page { property bool muted property string tagId - function show(id_, hidden_, muted_) { + function show(parent, id_, hidden_, muted_) { tagId = id_; hidden = hidden_; muted = muted_; - open(); + popup(parent); } MenuItem { diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index b99e5f63..a49761b2 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -420,9 +420,9 @@ Item { else link = ""; if (showAt_) - open(showAt_); + popup(showAt_); else - open(); + popup(); } Component { diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index 1d8bff88..44a3e333 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -41,6 +41,8 @@ Page { id: buttonRow ImageButton { + id: startChatButton + Layout.fillWidth: true Layout.margins: Nheko.paddingMedium ToolTip.delay: Nheko.tooltipDelay @@ -51,7 +53,7 @@ Page { hoverEnabled: true image: ":/icons/icons/ui/add-square-button.svg" - onClicked: roomJoinCreateMenu.open(parent) + onClicked: roomJoinCreateMenu.popup(startChatButton) Menu { id: roomJoinCreateMenu @@ -302,19 +304,23 @@ Page { } } TapHandler { + id: userTapHandler + acceptedButtons: Qt.LeftButton gesturePolicy: TapHandler.ReleaseWithinBounds margin: -Nheko.paddingSmall - onLongPressed: userInfoMenu.open() + onLongPressed: userInfoMenu.popup(userTapHandler) onSingleTapped: userInfoPanel.openUserProfile() } TapHandler { + id: userTapHandler2 + acceptedButtons: Qt.RightButton gesturePolicy: TapHandler.ReleaseWithinBounds margin: -Nheko.paddingSmall - onSingleTapped: userInfoMenu.open() + onSingleTapped: userInfoMenu.popup(userTapHandler2) } } Rectangle { @@ -523,7 +529,7 @@ Page { } onPressAndHold: { if (!isInvite) - roomContextMenu.show(roomId, tags); + roomContextMenu.show(roomItem, roomId, tags); } Ripple { @@ -536,13 +542,15 @@ Page { anchors.margins: 1 TapHandler { + id: roomItemTh + acceptedButtons: Qt.RightButton acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad gesturePolicy: TapHandler.ReleaseWithinBounds onSingleTapped: { if (!TimelineManager.isInvite) - roomContextMenu.show(roomId, tags); + roomContextMenu.show(roomItemTh, roomId, tags); } } } @@ -738,10 +746,10 @@ Page { property string roomid property var tags - function show(roomid_, tags_) { + function show(parent, roomid_, tags_) { roomid = roomid_; tags = tags_; - open(); + popup(parent); } InputDialog { diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index e8e90749..4ffa2ecb 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -234,7 +234,7 @@ Pane { image: ":/icons/icons/ui/options.svg" visible: !!room - onClicked: roomOptionsMenu.open(roomOptionsButton) + onClicked: roomOptionsMenu.popup(roomOptionsButton) Menu { id: roomOptionsMenu diff --git a/resources/qml/components/SpaceMenuLevel.qml b/resources/qml/components/SpaceMenuLevel.qml index 1c4c67f5..e191b32b 100644 --- a/resources/qml/components/SpaceMenuLevel.qml +++ b/resources/qml/components/SpaceMenuLevel.qml @@ -73,7 +73,7 @@ Menu { MenuSeparator { //text: qsTr("Subcommunities") ButtonGroup.group: modificationGroup - visible: modificationGroup.visible && inst.model != undefined + visible: position != -1 && inst.model != undefined } Instantiator {