Fix menu positions

This commit is contained in:
Nicolas Werner 2024-10-08 23:35:13 +02:00
parent 65c6e96e24
commit 5523460f4e
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
5 changed files with 24 additions and 15 deletions

View file

@ -100,17 +100,18 @@ Page {
] ]
onClicked: Communities.setCurrentTagId(model.id) 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 { Item {
anchors.fill: parent anchors.fill: parent
TapHandler { TapHandler {
id: rth
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
onSingleTapped: communityContextMenu.show(model.id, model.hidden, model.muted) onSingleTapped: communityContextMenu.show(rth, model.id, model.hidden, model.muted)
} }
} }
RowLayout { RowLayout {
@ -201,11 +202,11 @@ Page {
property bool muted property bool muted
property string tagId property string tagId
function show(id_, hidden_, muted_) { function show(parent, id_, hidden_, muted_) {
tagId = id_; tagId = id_;
hidden = hidden_; hidden = hidden_;
muted = muted_; muted = muted_;
open(); popup(parent);
} }
MenuItem { MenuItem {

View file

@ -420,9 +420,9 @@ Item {
else else
link = ""; link = "";
if (showAt_) if (showAt_)
open(showAt_); popup(showAt_);
else else
open(); popup();
} }
Component { Component {

View file

@ -41,6 +41,8 @@ Page {
id: buttonRow id: buttonRow
ImageButton { ImageButton {
id: startChatButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: Nheko.paddingMedium Layout.margins: Nheko.paddingMedium
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
@ -51,7 +53,7 @@ Page {
hoverEnabled: true hoverEnabled: true
image: ":/icons/icons/ui/add-square-button.svg" image: ":/icons/icons/ui/add-square-button.svg"
onClicked: roomJoinCreateMenu.open(parent) onClicked: roomJoinCreateMenu.popup(startChatButton)
Menu { Menu {
id: roomJoinCreateMenu id: roomJoinCreateMenu
@ -302,19 +304,23 @@ Page {
} }
} }
TapHandler { TapHandler {
id: userTapHandler
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
margin: -Nheko.paddingSmall margin: -Nheko.paddingSmall
onLongPressed: userInfoMenu.open() onLongPressed: userInfoMenu.popup(userTapHandler)
onSingleTapped: userInfoPanel.openUserProfile() onSingleTapped: userInfoPanel.openUserProfile()
} }
TapHandler { TapHandler {
id: userTapHandler2
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
margin: -Nheko.paddingSmall margin: -Nheko.paddingSmall
onSingleTapped: userInfoMenu.open() onSingleTapped: userInfoMenu.popup(userTapHandler2)
} }
} }
Rectangle { Rectangle {
@ -523,7 +529,7 @@ Page {
} }
onPressAndHold: { onPressAndHold: {
if (!isInvite) if (!isInvite)
roomContextMenu.show(roomId, tags); roomContextMenu.show(roomItem, roomId, tags);
} }
Ripple { Ripple {
@ -536,13 +542,15 @@ Page {
anchors.margins: 1 anchors.margins: 1
TapHandler { TapHandler {
id: roomItemTh
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
onSingleTapped: { onSingleTapped: {
if (!TimelineManager.isInvite) if (!TimelineManager.isInvite)
roomContextMenu.show(roomId, tags); roomContextMenu.show(roomItemTh, roomId, tags);
} }
} }
} }
@ -738,10 +746,10 @@ Page {
property string roomid property string roomid
property var tags property var tags
function show(roomid_, tags_) { function show(parent, roomid_, tags_) {
roomid = roomid_; roomid = roomid_;
tags = tags_; tags = tags_;
open(); popup(parent);
} }
InputDialog { InputDialog {

View file

@ -234,7 +234,7 @@ Pane {
image: ":/icons/icons/ui/options.svg" image: ":/icons/icons/ui/options.svg"
visible: !!room visible: !!room
onClicked: roomOptionsMenu.open(roomOptionsButton) onClicked: roomOptionsMenu.popup(roomOptionsButton)
Menu { Menu {
id: roomOptionsMenu id: roomOptionsMenu

View file

@ -73,7 +73,7 @@ Menu {
MenuSeparator { MenuSeparator {
//text: qsTr("Subcommunities") //text: qsTr("Subcommunities")
ButtonGroup.group: modificationGroup ButtonGroup.group: modificationGroup
visible: modificationGroup.visible && inst.model != undefined visible: position != -1 && inst.model != undefined
} }
Instantiator { Instantiator {