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 {
|
ChannelContextMenu {
|
||||||
id: chatContextMenu
|
id: chatContextMenu
|
||||||
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupMenu {
|
PopupMenu {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.13
|
import QtQuick 2.13
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.13
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.13
|
||||||
|
import "../../../../imports"
|
||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/status"
|
import "../../../../shared/status"
|
||||||
import "../components"
|
import "../components"
|
||||||
|
@ -13,15 +14,19 @@ StatusRoundButton {
|
||||||
width: 36
|
width: 36
|
||||||
height: 36
|
height: 36
|
||||||
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
btnAdd.state = "pressed"
|
if (newChatMenu.opened) {
|
||||||
|
newChatMenu.close()
|
||||||
|
} else {
|
||||||
let x = btnAdd.iconX + btnAdd.icon.width / 2 - newChatMenu.width / 2
|
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 {
|
PopupMenu {
|
||||||
id: newChatMenu
|
id: newChatMenu
|
||||||
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
//% "Start new chat"
|
//% "Start new chat"
|
||||||
text: qsTrId("start-new-chat")
|
text: qsTrId("start-new-chat")
|
||||||
|
@ -57,6 +62,10 @@ StatusRoundButton {
|
||||||
openPopup(communitiesPopupComponent)
|
openPopup(communitiesPopupComponent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onAboutToShow: {
|
||||||
|
btnAdd.state = "pressed"
|
||||||
|
}
|
||||||
|
|
||||||
onAboutToHide: {
|
onAboutToHide: {
|
||||||
btnAdd.state = "default"
|
btnAdd.state = "default"
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,15 +145,19 @@ Item {
|
||||||
flipImage: true
|
flipImage: true
|
||||||
text: ""
|
text: ""
|
||||||
onClicked: function () {
|
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
|
let x = settingsBtn.x + settingsBtn.width / 2 - newSettingsMenu.width / 2
|
||||||
newSettingsMenu.popup(x, settingsBtn.height)
|
newSettingsMenu.popup(x, settingsBtn.height)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
anchors.left: receiveBtn.right
|
anchors.left: receiveBtn.right
|
||||||
anchors.leftMargin: walletMenu.btnOuterMargin
|
anchors.leftMargin: walletMenu.btnOuterMargin
|
||||||
|
|
||||||
PopupMenu {
|
PopupMenu {
|
||||||
id: newSettingsMenu
|
id: newSettingsMenu
|
||||||
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||||
width: 176
|
width: 176
|
||||||
Action {
|
Action {
|
||||||
//% "Account Settings"
|
//% "Account Settings"
|
||||||
|
|
|
@ -14,9 +14,12 @@ StatusRoundButton {
|
||||||
height: 36
|
height: 36
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
btnAdd.state = "pressed"
|
if (newAccountMenu.opened) {
|
||||||
|
newAccountMenu.close()
|
||||||
|
} else {
|
||||||
let x = btnAdd.iconX + btnAdd.icon.width / 2 - newAccountMenu.width / 2
|
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 {
|
GenerateAccountModal {
|
||||||
|
@ -35,6 +38,7 @@ StatusRoundButton {
|
||||||
PopupMenu {
|
PopupMenu {
|
||||||
id: newAccountMenu
|
id: newAccountMenu
|
||||||
width: 260
|
width: 260
|
||||||
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||||
Action {
|
Action {
|
||||||
//% "Generate an account"
|
//% "Generate an account"
|
||||||
text: qsTrId("generate-a-new-account")
|
text: qsTrId("generate-a-new-account")
|
||||||
|
@ -75,6 +79,10 @@ StatusRoundButton {
|
||||||
addAccountWithPrivateKeydModal.open()
|
addAccountWithPrivateKeydModal.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onAboutToShow: {
|
||||||
|
btnAdd.state = "pressed"
|
||||||
|
}
|
||||||
|
|
||||||
onAboutToHide: {
|
onAboutToHide: {
|
||||||
btnAdd.state = "default"
|
btnAdd.state = "default"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue