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)
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 {

View file

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

View file

@ -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 {

View file

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

View file

@ -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 {