Make Right Click on Room bring up Context Menu

BUG: 454892
This commit is contained in:
Jan Bidler
2022-06-06 19:38:50 +02:00
parent 014826bd09
commit b44e81c849

View File

@@ -229,14 +229,11 @@ Kirigami.ScrollablePage {
subtitle: subtitleText subtitle: subtitleText
subtitleItem.textFormat: Text.PlainText subtitleItem.textFormat: Text.PlainText
onPressAndHold: { onPressAndHold: {
const menu = roomListContextMenu.createObject(page, {"room": currentRoom}) createRoomListContextMenu()
configButton.visible = true }
configButton.down = true TapHandler {
menu.closed.connect(function() { acceptedButtons: Qt.RightButton
configButton.down = undefined onTapped: createRoomListContextMenu()
configButton.visible = Qt.binding(function() { return roomListItem.hovered || Kirigami.Settings.isMobile })
})
menu.open()
} }
leading: Kirigami.Avatar { leading: Kirigami.Avatar {
@@ -271,18 +268,22 @@ Kirigami.ScrollablePage {
id: optionAction id: optionAction
icon.name: "configure" icon.name: "configure"
onTriggered: { onTriggered: {
const menu = roomListContextMenu.createObject(page, {"room": currentRoom}) createRoomListContextMenu()
configButton.visible = true
configButton.down = true
menu.closed.connect(function() {
configButton.down = undefined
configButton.visible = Qt.binding(function() { return roomListItem.hovered || Kirigami.Settings.isMobile })
})
menu.open()
} }
} }
} }
} }
function createRoomListContextMenu() {
const menu = roomListContextMenu.createObject(page, {"room": currentRoom})
configButton.visible = true
configButton.down = true
menu.closed.connect(function() {
configButton.down = undefined
configButton.visible = Qt.binding(function() { return roomListItem.hovered || Kirigami.Settings.isMobile })
})
menu.open()
}
} }
} }
} }