main
zhuzihcu 2023-03-16 18:11:03 +08:00
parent 96355b0a97
commit 2de9d78f41
4 changed files with 85 additions and 66 deletions

View File

@ -115,6 +115,49 @@ FluScrollablePage{
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluDropDownButton{
disabled:drop_down_button_switch.selected
text:"DropDownButton"
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
items:[
FluMenuItem{
text:"Menu_1"
},
FluMenuItem{
text:"Menu_2"
},
FluMenuItem{
text:"Menu_3"
},
FluMenuItem{
text:"Menu_4"
}
]
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:drop_down_button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
}
FluArea{
width: parent.width
height: 100
@ -190,39 +233,5 @@ FluScrollablePage{
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluDropDownButton{
disabled:drop_down_button_switch.selected
text:"DropDownButton"
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
items:[
FluMenuItem{
text:"asdf"
}
]
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:drop_down_button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
}
}

View File

@ -205,6 +205,9 @@ Rectangle {
ScrollBar.vertical: FluScrollBar {}
model: generateYearArray(1924,2048)
clip: true
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
visible: showYear
delegate: Loader{
property var model: modelData
@ -212,11 +215,6 @@ Rectangle {
property int position:index
sourceComponent: list_delegate
}
onCurrentIndexChanged: {
if(currentIndex!==-1){
list_view_1.positionViewAtIndex(currentIndex, ListView.NoPosition)
}
}
}
Rectangle{
width: 1
@ -229,6 +227,9 @@ Rectangle {
height: parent.height
clip: true
ScrollBar.vertical: FluScrollBar {}
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
boundsBehavior:Flickable.StopAtBounds
delegate: Loader{
property var model: modelData
@ -236,11 +237,6 @@ Rectangle {
property int position:index
sourceComponent: list_delegate
}
onCurrentIndexChanged: {
if(currentIndex!==-1){
list_view_2.positionViewAtIndex(currentIndex, ListView.NoPosition)
}
}
}
Rectangle{
width: 1
@ -252,6 +248,9 @@ Rectangle {
width: showYear ? 100 : 150
height: parent.height
clip: true
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
ScrollBar.vertical: FluScrollBar {}
Layout.alignment: Qt.AlignVCenter
boundsBehavior:Flickable.StopAtBounds
@ -261,9 +260,6 @@ Rectangle {
property int position:index
sourceComponent: list_delegate
}
onCurrentIndexChanged: {
list_view_3.positionViewAtIndex(currentIndex, ListView.NoPosition)
}
}
}
@ -348,10 +344,12 @@ Rectangle {
text_day.text = day
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+35+340){
popup.y = 35
}else{
popup.y = window.height-(pos.y+340)
if(window.height>pos.y+root.height+popup.height){
popup.y = root.height
} else if(pos.y>popup.height){
popup.y = -popup.height
} else {
popup.y = window.height-(pos.y+popup.height)
}
popup.open()
}

View File

@ -1,5 +1,6 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import FluentUI 1.0
Button {
@ -16,6 +17,7 @@ Button {
rightPadding:35
enabled: !disabled
focusPolicy:Qt.TabFocus
property var window : Window.window
property alias items: menu.content
@ -68,12 +70,20 @@ Button {
}
onClicked: {
var pos = control.mapToItem(null, 0, 0)
if(window.height>pos.y+control.height+menu.height){
menu.y = control.height
}else if(pos.y>menu.height){
menu.y = -menu.height
}else{
popup.y = window.height-(pos.y+menu.height)
}
menu.open()
}
FluMenu{
id:menu
width: control.width
id:menu
width: control.width
}
}

View File

@ -202,6 +202,9 @@ Rectangle {
height: parent.height
boundsBehavior:Flickable.StopAtBounds
ScrollBar.vertical: FluScrollBar {}
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
model: isH ? generateArray(1,12) : generateArray(0,23)
clip: true
delegate: Loader{
@ -210,9 +213,6 @@ Rectangle {
property int position:index
sourceComponent: list_delegate
}
onCurrentIndexChanged: {
list_view_1.positionViewAtIndex(currentIndex, ListView.NoPosition)
}
}
Rectangle{
width: 1
@ -225,6 +225,9 @@ Rectangle {
height: parent.height
model: generateArray(0,59)
clip: true
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
ScrollBar.vertical: FluScrollBar {}
boundsBehavior:Flickable.StopAtBounds
delegate: Loader{
@ -233,9 +236,6 @@ Rectangle {
property int position:index
sourceComponent: list_delegate
}
onCurrentIndexChanged: {
list_view_2.positionViewAtIndex(currentIndex, ListView.NoPosition)
}
}
Rectangle{
width: 1
@ -250,6 +250,9 @@ Rectangle {
model: ["上午","下午"]
clip: true
visible: isH
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
ScrollBar.vertical: FluScrollBar {}
Layout.alignment: Qt.AlignVCenter
boundsBehavior:Flickable.StopAtBounds
@ -259,9 +262,6 @@ Rectangle {
property int position:index
sourceComponent: list_delegate
}
onCurrentIndexChanged: {
list_view_3.positionViewAtIndex(currentIndex, ListView.NoPosition)
}
}
}
@ -358,10 +358,12 @@ Rectangle {
}
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+35+340){
popup.y = 35
}else{
popup.y = window.height-(pos.y+340)
if(window.height>pos.y+root.height+popup.height){
popup.y = root.height
} else if(pos.y>popup.height){
popup.y = -popup.height
} else {
popup.y = window.height-(pos.y+popup.height)
}
popup.open()
}