fix: close chat menu when re-clicking the button

This commit is contained in:
Jonathan Rainville 2020-07-09 13:36:42 -04:00 committed by Iuri Matias
parent bcee0079e5
commit b5619dadaf
1 changed files with 10 additions and 3 deletions

View File

@ -77,6 +77,8 @@ Rectangle {
font.pixelSize: 25
MouseArea {
property bool menuOpened: false
id: mouseArea
// The negative margins are for the mouse area to be a bit more wide around the button and have more space for the click
anchors.topMargin: -10
@ -90,9 +92,14 @@ Rectangle {
menu = groupContextMenu
}
if (!menuOpened) {
menu.arrowX = menu.width - 40
menu.popup(moreActionsBtn.x, moreActionsBtn.height + 10)
menuOpened = true
} else {
menu.dismiss()
menuOpened = false
}
}
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton