This commit is contained in:
朱子楚\zhuzi 2024-04-23 21:19:32 +08:00
parent b8ef9169b9
commit 04c52b1b25
2 changed files with 12 additions and 4 deletions

View File

@ -19,16 +19,20 @@ FluButton {
} }
iconColor:control.textColor iconColor:control.textColor
} }
Item{
id: d
property var window: Window.window
}
onClicked: { onClicked: {
if(menu.count !==0){ if(menu.count !==0){
var pos = control.mapToItem(null, 0, 0) var pos = control.mapToItem(null, 0, 0)
var containerHeight = menu.count*36 var containerHeight = menu.count*36
if(window.height>pos.y+control.height+containerHeight){ if(d.window.height>pos.y+control.height+containerHeight){
menu.y = control.height menu.y = control.height
}else if(pos.y>containerHeight){ }else if(pos.y>containerHeight){
menu.y = -containerHeight menu.y = -containerHeight
}else{ }else{
menu.y = window.height-(pos.y+containerHeight) menu.y = d.window.height-(pos.y+containerHeight)
} }
menu.open() menu.open()
} }

View File

@ -20,16 +20,20 @@ FluButton {
} }
iconColor:control.textColor iconColor:control.textColor
} }
Item{
id: d
property var window: Window.window
}
onClicked: { onClicked: {
if(menu.count !==0){ if(menu.count !==0){
var pos = control.mapToItem(null, 0, 0) var pos = control.mapToItem(null, 0, 0)
var containerHeight = menu.count*36 var containerHeight = menu.count*36
if(window.height>pos.y+control.height+containerHeight){ if(d.window.height>pos.y+control.height+containerHeight){
menu.y = control.height menu.y = control.height
}else if(pos.y>containerHeight){ }else if(pos.y>containerHeight){
menu.y = -containerHeight menu.y = -containerHeight
}else{ }else{
menu.y = window.height-(pos.y+containerHeight) menu.y = d.window.height-(pos.y+containerHeight)
} }
menu.open() menu.open()
} }