Commit 2e0d85e1 authored by Tranter Madi's avatar Tranter Madi 🌧
Browse files

Improve Menu button's code

parent 629443d3
Pipeline #146425 passed with stage
in 7 minutes and 35 seconds
......@@ -189,23 +189,22 @@ BasePlayerControl {
text: i18nc("open application menu", "Application Menu")
icon.name: "open-menu-symbolic"
checkable: true
checked: applicationMenu.visible
down: applicationMenu.visible
onClicked: {
if (applicationMenu.visible) {
applicationMenu.close()
} else {
var pos = menuButton.mapFromItem(headerBar, headerBar.width - applicationMenu.width, headerBar.height)
applicationMenu.popup(pos.x, pos.y)
if (!applicationMenu.visible) {
applicationMenu.open()
}
}
ApplicationMenu {
id: applicationMenu
// otherwise clicking on the menu button will not close it
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
y: menuButton.height
// without modal, clicking on menuButton will not close the menu
modal: true
dim: false
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment