From f913263de6e8de968dc1795ea48c231f6b5a5c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Wed, 23 Aug 2023 20:11:42 +0800 Subject: [PATCH] fix #259 --- src/imports/FluentUI/Controls/FluCalendarPicker.qml | 9 ++++++--- src/imports/FluentUI/Controls/FluColorPicker.qml | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/imports/FluentUI/Controls/FluCalendarPicker.qml b/src/imports/FluentUI/Controls/FluCalendarPicker.qml index 02bf1250..69d81ac4 100644 --- a/src/imports/FluentUI/Controls/FluCalendarPicker.qml +++ b/src/imports/FluentUI/Controls/FluCalendarPicker.qml @@ -9,7 +9,6 @@ Rectangle { property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1) property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1) property string text: "请选择日期" - property var window : Window.window id:control color: { if(mouse_area.containsMouse){ @@ -30,6 +29,10 @@ Rectangle { popup.showPopup() } } + Item{ + id:d + property var window : Window.window + } FluText{ id:text_date anchors{ @@ -97,12 +100,12 @@ Rectangle { } function showPopup() { var pos = control.mapToItem(null, 0, 0) - if(window.height>pos.y+control.height+container.height){ + if(d.window.height>pos.y+control.height+container.height){ popup.y = control.height } else if(pos.y>container.height){ popup.y = -container.height } else { - popup.y = window.height-(pos.y+container.height) + popup.y = d.window.height-(pos.y+container.height) } popup.x = -(popup.width-control.width)/2 popup.open() diff --git a/src/imports/FluentUI/Controls/FluColorPicker.qml b/src/imports/FluentUI/Controls/FluColorPicker.qml index e667ea8e..0fe2fd40 100644 --- a/src/imports/FluentUI/Controls/FluColorPicker.qml +++ b/src/imports/FluentUI/Controls/FluColorPicker.qml @@ -32,6 +32,10 @@ Button{ } } + Item{ + id: d + property var window : Window.window + } contentItem: Item{} onClicked: { popup.showPopup() @@ -73,12 +77,12 @@ Button{ } function showPopup() { var pos = control.mapToItem(null, 0, 0) - if(window.height>pos.y+control.height+container.height){ + if(d.window.height>pos.y+control.height+container.height){ popup.y = control.height } else if(pos.y>container.height){ popup.y = -container.height } else { - popup.y = window.height-(pos.y+container.height) + popup.y = d.window.height-(pos.y+container.height) } popup.x = -(popup.width-control.width)/2 popup.open()