main
朱子楚\zhuzi 2023-05-14 19:06:10 +08:00
parent 87a1e4744c
commit 0c7fa3e5bb
5 changed files with 69 additions and 28 deletions

View File

@ -1,14 +1,62 @@
import QtQuick import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI import FluentUI
FluWindow { Window {
id:window id:window
width: 400 title: "132"
height: 400
visible: true visible: true
width: 600
color: "#00000000"
height: 480
FluInfoBar{
id:info_bar
root: window
}
Rectangle{
anchors.fill: parent
color: "#FFFFFF"
}
FluButton{ FluButton{
x: 23
y: 31
text:"123" 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
} }
} }

View File

@ -3,7 +3,7 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
FluWindow { Window {
id:window id:window
title:"SingleTask" title:"SingleTask"

View File

@ -74,16 +74,18 @@ Button {
} }
onClicked: { onClicked: {
var pos = control.mapToItem(null, 0, 0) if(items && menu.getContainerCount()!==0){
var containerHeight = menu.getContainerHeight() var pos = control.mapToItem(null, 0, 0)
if(window.height>pos.y+control.height+containerHeight){ var containerHeight = menu.getContainerHeight()
menu.y = control.height if(window.height>pos.y+control.height+containerHeight){
}else if(pos.y>containerHeight){ menu.y = control.height
menu.y = -containerHeight }else if(pos.y>containerHeight){
}else{ menu.y = -containerHeight
menu.y = window.height-(pos.y+containerHeight) }else{
menu.y = window.height-(pos.y+containerHeight)
}
menu.open()
} }
menu.open()
} }
FluMenu{ FluMenu{

View File

@ -61,4 +61,8 @@ Menu {
return container.height return container.height
} }
function getContainerCount(){
return container.children.length
}
} }

View File

@ -1,19 +1,5 @@
MetaInfo { 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 { Type {
name: "FluentUI.Controls.FluTextButton" name: "FluentUI.Controls.FluTextButton"
icon: "images/button-icon16.png" icon: "images/button-icon16.png"
@ -154,4 +140,5 @@ MetaInfo {
Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")" } Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")" }
} }
} }
} }