This commit is contained in:
朱子楚\zhuzi 2023-06-13 23:57:52 +08:00
parent 4f9ec6abf2
commit c07011408c
3 changed files with 95 additions and 4 deletions

View File

@ -9,7 +9,7 @@ FluObject{
FluPaneItem{ FluPaneItem{
id:item_home id:item_home
property int count: 8 count: 9
title:lang.home title:lang.home
infoBadge:FluBadge{ infoBadge:FluBadge{
count: item_home.count count: item_home.count
@ -27,11 +27,17 @@ FluObject{
title:lang.basic_input title:lang.basic_input
icon:FluentIcons.CheckboxComposite icon:FluentIcons.CheckboxComposite
FluPaneItem{ FluPaneItem{
id:item_buttons
count: 99
infoBadge:FluBadge{
count: item_buttons.count
}
title:"Buttons" title:"Buttons"
image:"qrc:/example/res/image/control/Button.png" image:"qrc:/example/res/image/control/Button.png"
recentlyUpdated:true recentlyUpdated:true
desc:"A control that responds to user input and raisesa Click event." desc:"A control that responds to user input and raisesa Click event."
onTap:{ onTap:{
item_buttons.count = 0
navigationView.push("qrc:/example/qml/page/T_Buttons.qml") navigationView.push("qrc:/example/qml/page/T_Buttons.qml")
} }
} }
@ -168,8 +174,15 @@ FluObject{
} }
} }
FluPaneItem{ FluPaneItem{
id:item_combobox
title:"ComboBox" title:"ComboBox"
count: 9
infoBadge:FluBadge{
count: item_combobox.count
color: Qt.rgba(250/255,173/255,20/255,1)
}
onTap:{ onTap:{
item_combobox.count = 0
navigationView.push("qrc:/example/qml/page/T_ComboBox.qml") navigationView.push("qrc:/example/qml/page/T_ComboBox.qml")
} }
} }
@ -283,8 +296,15 @@ FluObject{
title:lang.other title:lang.other
icon:FluentIcons.Shop icon:FluentIcons.Shop
FluPaneItem{ FluPaneItem{
id:item_other
title:"RemoteLoader" title:"RemoteLoader"
count: 99
infoBadge:FluBadge{
count: item_other.count
color: Qt.rgba(82/255,196/255,26/255,1)
}
onTap:{ onTap:{
item_other.count = 0
navigationView.push("qrc:/example/qml/page/T_RemoteLoader.qml") navigationView.push("qrc:/example/qml/page/T_RemoteLoader.qml")
} }
} }

View File

@ -178,6 +178,33 @@ Item {
} }
model.isExpand = !model.isExpand model.isExpand = !model.isExpand
} }
Rectangle{
color:Qt.rgba(255/255,77/255,79/255,1)
width: 10
height: 10
radius: 5
border.width: 1
border.color: Qt.rgba(1,1,1,1)
anchors{
right: parent.right
verticalCenter: parent.verticalCenter
rightMargin: 3
verticalCenterOffset: -8
}
visible: {
if(!model.isExpand){
for(var i=0;i<model.children.length;i++){
var item = model.children[i]
if(item.infoBadge && item.count !==0){
return true
}
}
}
return false
}
}
Rectangle{ Rectangle{
radius: 4 radius: 4
anchors.fill: parent anchors.fill: parent
@ -199,7 +226,9 @@ Item {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
} }
FluIcon{ FluIcon{
id:item_icon_expand
rotation: model.isExpand?0:180 rotation: model.isExpand?0:180
iconSource:FluentIcons.ChevronUp iconSource:FluentIcons.ChevronUp
iconSize: 15 iconSize: 15
@ -279,9 +308,11 @@ Item {
} }
return true return true
} }
elide: Text.ElideRight
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:item_icon.right left:item_icon.right
right: item_icon_expand.left
} }
color:{ color:{
if(item_control.pressed){ if(item_control.pressed){
@ -429,6 +460,7 @@ Item {
} }
return true return true
} }
elide: Text.ElideRight
color:{ color:{
if(item_control.pressed){ if(item_control.pressed){
return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120
@ -438,13 +470,17 @@ Item {
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:item_icon.right left:item_icon.right
right: item_dot_loader.left
} }
} }
Loader{ Loader{
id:item_dot_loader
property bool isDot: (item_dot_loader.item&&item_dot_loader.item.isDot)
anchors{ anchors{
right: parent.right right: parent.right
rightMargin: 10
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
rightMargin: isDot ? 3 : 10
verticalCenterOffset: isDot ? -8 : 0
} }
sourceComponent: { sourceComponent: {
if(model.infoBadge){ if(model.infoBadge){
@ -452,6 +488,14 @@ Item {
} }
return undefined return undefined
} }
Connections{
target: d
function onIsCompactAndNotPanelChanged(){
if(item_dot_loader.item){
item_dot_loader.item.isDot = d.isCompactAndNotPanel
}
}
}
} }
} }
} }
@ -822,6 +866,14 @@ Item {
duration: 83 duration: 83
} }
} }
Connections{
target: d
function onIsCompactChanged(){
if(!d.isCompact){
control_popup.close()
}
}
}
padding: 0 padding: 0
focus: true focus: true
contentItem: Item{ contentItem: Item{
@ -834,7 +886,7 @@ Item {
ScrollBar.vertical: FluScrollBar {} ScrollBar.vertical: FluScrollBar {}
delegate:Button{ delegate:Button{
id:item_button id:item_button
width: 160 width: 180
padding:10 padding:10
focusPolicy:Qt.TabFocus focusPolicy:Qt.TabFocus
background: Rectangle{ background: Rectangle{
@ -848,9 +900,27 @@ Item {
visible: item_button.activeFocus visible: item_button.activeFocus
radius:4 radius:4
} }
Loader{
id:item_dot_loader
anchors{
right: parent.right
verticalCenter: parent.verticalCenter
rightMargin: 10
}
sourceComponent: {
if(model.infoBadge){
return model.infoBadge
}
return undefined
}
}
} }
contentItem: FluText{ contentItem: FluText{
text:modelData.title text:modelData.title
elide: Text.ElideRight
rightPadding: item_dot_loader.width
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
@ -872,7 +942,7 @@ Item {
} }
} }
background: FluRectangle{ background: FluRectangle{
implicitWidth: 160 implicitWidth: 180
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8) implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
radius: [4,4,4,4] radius: [4,4,4,4]
FluShadow{ FluShadow{

View File

@ -16,6 +16,7 @@ QtObject {
property var image property var image
property var parent property var parent
property int idx property int idx
property int count: 0
signal tap signal tap
property var tapFunc property var tapFunc
} }