From 0c7fa3e5bb06dd76758eac0d747a5e076a2187a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 14 May 2023 19:06:10 +0800 Subject: [PATCH] update --- example/qml/TestWindow.qml | 54 +++++++++++++++++-- example/qml/window/SingleTaskWindow.qml | 2 +- .../FluentUI/Controls/FluDropDownButton.qml | 20 +++---- src/imports/FluentUI/Controls/FluMenu.qml | 4 ++ .../FluentUI/designer/fluentui.metainfo | 17 +----- 5 files changed, 69 insertions(+), 28 deletions(-) diff --git a/example/qml/TestWindow.qml b/example/qml/TestWindow.qml index 0f33e73..ac55404 100644 --- a/example/qml/TestWindow.qml +++ b/example/qml/TestWindow.qml @@ -1,14 +1,62 @@ import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts import FluentUI -FluWindow { +Window { id:window - width: 400 - height: 400 + title: "132" visible: true + width: 600 + color: "#00000000" + height: 480 + + FluInfoBar{ + id:info_bar + root: window + } + + Rectangle{ + anchors.fill: parent + color: "#FFFFFF" + } FluButton{ + x: 23 + y: 31 text:"123" + onClicked: { + info_bar.showSuccess("asdasd") + } + } + + FluFilledButton{ + x: 23 + y: 95 + text: "asdasd" + onClicked: { + info_bar.showInfo("123132") + } + } + + FluTextBox{ + text: "asdasd" + anchors.verticalCenterOffset: -59 + anchors.horizontalCenterOffset: -127 + anchors.centerIn: parent + } + + FluProgressBar{ + x: 23 + y: 238 + + } + + FluProgressRing{ + x: 18 + y: 283 + } } diff --git a/example/qml/window/SingleTaskWindow.qml b/example/qml/window/SingleTaskWindow.qml index 510195b..b56e8a1 100644 --- a/example/qml/window/SingleTaskWindow.qml +++ b/example/qml/window/SingleTaskWindow.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Layouts import FluentUI -FluWindow { +Window { id:window title:"SingleTask" diff --git a/src/imports/FluentUI/Controls/FluDropDownButton.qml b/src/imports/FluentUI/Controls/FluDropDownButton.qml index dadb829..9112e0e 100644 --- a/src/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/imports/FluentUI/Controls/FluDropDownButton.qml @@ -74,16 +74,18 @@ Button { } onClicked: { - var pos = control.mapToItem(null, 0, 0) - var containerHeight = menu.getContainerHeight() - if(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) + if(items && menu.getContainerCount()!==0){ + var pos = control.mapToItem(null, 0, 0) + var containerHeight = menu.getContainerHeight() + if(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.open() } - menu.open() } FluMenu{ diff --git a/src/imports/FluentUI/Controls/FluMenu.qml b/src/imports/FluentUI/Controls/FluMenu.qml index fe4598a..e62d59d 100644 --- a/src/imports/FluentUI/Controls/FluMenu.qml +++ b/src/imports/FluentUI/Controls/FluMenu.qml @@ -61,4 +61,8 @@ Menu { return container.height } + function getContainerCount(){ + return container.children.length + } + } diff --git a/src/imports/FluentUI/designer/fluentui.metainfo b/src/imports/FluentUI/designer/fluentui.metainfo index 4baa675..c5b3948 100644 --- a/src/imports/FluentUI/designer/fluentui.metainfo +++ b/src/imports/FluentUI/designer/fluentui.metainfo @@ -1,19 +1,5 @@ MetaInfo { - Type { - name: "FluentUI.Controls.FluWindow" - icon: "images/button-icon16.png" - - ItemLibraryEntry { - name: "FluWindow" - category: "FluentUI - Controls" - libraryIcon: "images/button-icon.png" - version: "1.0" - requiredImport: "FluentUI" - toolTip: qsTr("FluWindow") - } - } - Type { name: "FluentUI.Controls.FluTextButton" icon: "images/button-icon16.png" @@ -154,4 +140,5 @@ MetaInfo { Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")" } } } -} + +} \ No newline at end of file