From 04c52b1b25a93284baea366ab9c594f2f875b072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 23 Apr 2024 21:19:32 +0800 Subject: [PATCH] fix bug --- src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml | 8 ++++++-- src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml b/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml index 60335194..18f7383d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluDropDownButton.qml @@ -19,16 +19,20 @@ FluButton { } iconColor:control.textColor } + Item{ + id: d + property var window: Window.window + } onClicked: { if(menu.count !==0){ var pos = control.mapToItem(null, 0, 0) 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 }else if(pos.y>containerHeight){ menu.y = -containerHeight }else{ - menu.y = window.height-(pos.y+containerHeight) + menu.y = d.window.height-(pos.y+containerHeight) } menu.open() } diff --git a/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml b/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml index 537c1604..79cd5502 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluDropDownButton.qml @@ -20,16 +20,20 @@ FluButton { } iconColor:control.textColor } + Item{ + id: d + property var window: Window.window + } onClicked: { if(menu.count !==0){ var pos = control.mapToItem(null, 0, 0) 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 }else if(pos.y>containerHeight){ menu.y = -containerHeight }else{ - menu.y = window.height-(pos.y+containerHeight) + menu.y = d.window.height-(pos.y+containerHeight) } menu.open() }