fix: menu dropdowns not closing on button click and position
This commit is contained in:
parent
62b0c63965
commit
6c0fce5b0c
|
@ -95,6 +95,7 @@ Rectangle {
|
|||
|
||||
ChannelContextMenu {
|
||||
id: chatContextMenu
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
}
|
||||
|
||||
PopupMenu {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Controls 2.13
|
||||
import QtQuick.Layouts 1.13
|
||||
import "../../../../imports"
|
||||
import "../../../../shared"
|
||||
import "../../../../shared/status"
|
||||
import "../components"
|
||||
|
@ -13,15 +14,19 @@ StatusRoundButton {
|
|||
width: 36
|
||||
height: 36
|
||||
|
||||
|
||||
onClicked: {
|
||||
btnAdd.state = "pressed"
|
||||
if (newChatMenu.opened) {
|
||||
newChatMenu.close()
|
||||
} else {
|
||||
let x = btnAdd.iconX + btnAdd.icon.width / 2 - newChatMenu.width / 2
|
||||
newChatMenu.popup(x, btnAdd.icon.height + 14)
|
||||
newChatMenu.popup(x, btnAdd.height + 4)
|
||||
}
|
||||
}
|
||||
|
||||
PopupMenu {
|
||||
id: newChatMenu
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
|
||||
Action {
|
||||
//% "Start new chat"
|
||||
text: qsTrId("start-new-chat")
|
||||
|
@ -57,6 +62,10 @@ StatusRoundButton {
|
|||
openPopup(communitiesPopupComponent)
|
||||
}
|
||||
}
|
||||
onAboutToShow: {
|
||||
btnAdd.state = "pressed"
|
||||
}
|
||||
|
||||
onAboutToHide: {
|
||||
btnAdd.state = "default"
|
||||
}
|
||||
|
|
|
@ -145,15 +145,19 @@ Item {
|
|||
flipImage: true
|
||||
text: ""
|
||||
onClicked: function () {
|
||||
// FIXME the button is too much on the right, so the arrow can never align
|
||||
if (newSettingsMenu.opened) {
|
||||
newSettingsMenu.close()
|
||||
} else {
|
||||
let x = settingsBtn.x + settingsBtn.width / 2 - newSettingsMenu.width / 2
|
||||
newSettingsMenu.popup(x, settingsBtn.height)
|
||||
}
|
||||
}
|
||||
anchors.left: receiveBtn.right
|
||||
anchors.leftMargin: walletMenu.btnOuterMargin
|
||||
|
||||
PopupMenu {
|
||||
id: newSettingsMenu
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
width: 176
|
||||
Action {
|
||||
//% "Account Settings"
|
||||
|
|
|
@ -14,9 +14,12 @@ StatusRoundButton {
|
|||
height: 36
|
||||
|
||||
onClicked: {
|
||||
btnAdd.state = "pressed"
|
||||
if (newAccountMenu.opened) {
|
||||
newAccountMenu.close()
|
||||
} else {
|
||||
let x = btnAdd.iconX + btnAdd.icon.width / 2 - newAccountMenu.width / 2
|
||||
newAccountMenu.popup(x, btnAdd.icon.height + 10)
|
||||
newAccountMenu.popup(x, btnAdd.height + 4)
|
||||
}
|
||||
}
|
||||
|
||||
GenerateAccountModal {
|
||||
|
@ -35,6 +38,7 @@ StatusRoundButton {
|
|||
PopupMenu {
|
||||
id: newAccountMenu
|
||||
width: 260
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
Action {
|
||||
//% "Generate an account"
|
||||
text: qsTrId("generate-a-new-account")
|
||||
|
@ -75,6 +79,10 @@ StatusRoundButton {
|
|||
addAccountWithPrivateKeydModal.open()
|
||||
}
|
||||
}
|
||||
onAboutToShow: {
|
||||
btnAdd.state = "pressed"
|
||||
}
|
||||
|
||||
onAboutToHide: {
|
||||
btnAdd.state = "default"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue