This commit is contained in:
朱子楚\zhuzi 2023-10-11 22:37:07 +08:00
parent a2e15fc3b0
commit 1003b34139
11 changed files with 133 additions and 74 deletions

View File

@ -45,6 +45,12 @@ FluObject{
} }
} }
FluPaneItemExpander{
title:"PaneItemExpander Disabled"
iconVisible: false
disabled: true
}
FluPaneItemExpander{ FluPaneItemExpander{
id:item_expander_basic_input id:item_expander_basic_input
title:Lang.basic_input title:Lang.basic_input
@ -381,12 +387,6 @@ FluObject{
} }
} }
FluPaneItemExpander{
title:"PaneItemExpander Disabled"
icon: FluentIcons.Send
disabled: true
}
FluPaneItemSeparator{ FluPaneItemSeparator{
spacing:10 spacing:10
size:1 size:1

View File

@ -39,7 +39,6 @@ FluWindow {
} }
} }
Component.onCompleted: { Component.onCompleted: {
console.debug(Lang.about)
FluTools.setQuitOnLastWindowClosed(false) FluTools.setQuitOnLastWindowClosed(false)
tour.open() tour.open()
checkUpdate(true) checkUpdate(true)

View File

@ -45,6 +45,12 @@ FluObject{
} }
} }
FluPaneItemExpander{
title:"PaneItemExpander Disabled"
iconVisible: false
disabled: true
}
FluPaneItemExpander{ FluPaneItemExpander{
id:item_expander_basic_input id:item_expander_basic_input
title:Lang.basic_input title:Lang.basic_input
@ -381,12 +387,6 @@ FluObject{
} }
} }
FluPaneItemExpander{
title:"PaneItemExpander Disabled"
icon: FluentIcons.Send
disabled: true
}
FluPaneItemSeparator{ FluPaneItemSeparator{
spacing:10 spacing:10
size:1 size:1

View File

@ -47,7 +47,7 @@ Item {
if(item instanceof FluPaneItemExpander){ if(item instanceof FluPaneItemExpander){
for(var j=0;j<item.children.length;j++){ for(var j=0;j<item.children.length;j++){
var itemChild = item.children[j] var itemChild = item.children[j]
itemChild.parent = item itemChild._parent = item
itemChild._idx = _idx itemChild._idx = _idx
data.push(itemChild) data.push(itemChild)
_idx++ _idx++
@ -124,8 +124,8 @@ Item {
if(!model){ if(!model){
return 1 return 1
} }
if(model.parent){ if(model._parent){
return model.parent.isExpand ? model.size : 0 return model._parent.isExpand ? model.size : 0
} }
return model.size return model.size
} }
@ -135,8 +135,8 @@ Item {
id:com_panel_item_header id:com_panel_item_header
Item{ Item{
height: { height: {
if(model.parent){ if(model._parent){
return model.parent.isExpand ? control.cellHeight : 0 return model._parent.isExpand ? control.cellHeight : 0
} }
return control.cellHeight return control.cellHeight
} }
@ -191,8 +191,13 @@ Item {
z:-100 z:-100
} }
onClicked: { onClicked: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel && model.children.length > 0){
control_popup.showPopup(Qt.point(50,mapToItem(control,0,0).y),model.children) let h = 38*Math.min(Math.max(model.children.length,1),8)
let y = mapToItem(control,0,0).y
if(h+y>control.height){
y = control.height - h
}
control_popup.showPopup(Qt.point(50,y),h,model.children)
return return
} }
model.isExpand = !model.isExpand model.isExpand = !model.isExpand
@ -260,7 +265,7 @@ Item {
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
rightMargin: 12 rightMargin: visible ? 12 : 0
} }
visible: { visible: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel){
@ -324,8 +329,14 @@ Item {
} }
Item{ Item{
id:item_icon id:item_icon
width: 30 width: visible ? 30 : 8
height: 30 height: 30
visible: {
if(model){
return model.iconVisible
}
return true
}
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:parent.left left:parent.left
@ -334,8 +345,8 @@ Item {
Loader{ Loader{
anchors.centerIn: parent anchors.centerIn: parent
sourceComponent: { sourceComponent: {
if(model&&model.cusIcon){ if(model&&model.iconDelegate){
return model.cusIcon return model.iconDelegate
} }
return com_icon return com_icon
} }
@ -345,13 +356,19 @@ Item {
id:item_title id:item_title
text:{ text:{
if(model){ if(model){
if(!item_icon.visible && d.isCompactAndNotPanel){
return model.title[0]
}
return model.title return model.title
} }
return "" return ""
} }
visible: { visible: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel){
return false if(item_icon.visible){
return false
}
return true
} }
return true return true
} }
@ -421,8 +438,8 @@ Item {
} }
} }
height: { height: {
if(model&&model.parent){ if(model&&model._parent){
return model.parent.isExpand ? control.cellHeight : 0 return model._parent.isExpand ? control.cellHeight : 0
} }
return control.cellHeight return control.cellHeight
} }
@ -560,8 +577,14 @@ Item {
} }
Item{ Item{
id:item_icon id:item_icon
width: 30
height: 30 height: 30
width: visible ? 30 : 8
visible: {
if(model){
return model.iconVisible
}
return true
}
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:parent.left left:parent.left
@ -570,8 +593,8 @@ Item {
Loader{ Loader{
anchors.centerIn: parent anchors.centerIn: parent
sourceComponent: { sourceComponent: {
if(model&&model.cusIcon){ if(model&&model.iconDelegate){
return model.cusIcon return model.iconDelegate
} }
return com_icon return com_icon
} }
@ -581,13 +604,19 @@ Item {
id:item_title id:item_title
text:{ text:{
if(model){ if(model){
if(!item_icon.visible && d.isCompactAndNotPanel){
return model.title[0]
}
return model.title return model.title
} }
return "" return ""
} }
visible: { visible: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel){
return false if(item_icon.visible){
return false
}
return true
} }
return true return true
} }
@ -1176,14 +1205,14 @@ Item {
} }
background: FluRectangle{ background: FluRectangle{
implicitWidth: 180 implicitWidth: 180
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
radius: [4,4,4,4] radius: [4,4,4,4]
FluShadow{ FluShadow{
radius: 4 radius: 4
} }
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
} }
function showPopup(pos,model){ function showPopup(pos,height,model){
background.implicitHeight = height
control_popup.x = pos.x control_popup.x = pos.x
control_popup.y = pos.y control_popup.y = pos.y
control_popup.childModel = model control_popup.childModel = model
@ -1311,8 +1340,8 @@ Item {
return return
} }
setCurrentIndex(i) setCurrentIndex(i)
if(item.parent && !d.isCompactAndNotPanel){ if(item._parent && !d.isCompactAndNotPanel){
item.parent.isExpand = true item._parent.isExpand = true
} }
return return
} }

View File

@ -6,23 +6,25 @@ QtObject {
readonly property string key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var _ext property var _ext
property var _parent
property string title property string title
property int order : 0 property int order : 0
property int icon
property var url property var url
property bool disabled: false property bool disabled: false
property Component cusIcon property int icon
property bool iconVisible: true
property Component infoBadge property Component infoBadge
property bool recentlyAdded: false property bool recentlyAdded: false
property bool recentlyUpdated: false property bool recentlyUpdated: false
property string desc property string desc
property var image property var image
property var parent
property int count: 0 property int count: 0
signal tap
property var onTapListener property var onTapListener
property Component iconDelegate
property Component menuDelegate property Component menuDelegate
property Component editDelegate property Component editDelegate
property bool showEdit property bool showEdit
signal tap
signal dropped(var drag) signal dropped(var drag)
} }

View File

@ -6,5 +6,5 @@ QtObject {
readonly property string key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var _ext property var _ext
property var parent property var _parent
} }

View File

@ -8,10 +8,10 @@ FluObject {
property string title property string title
property var icon property var icon
property bool disabled: false property bool disabled: false
property Component cusIcon property bool iconVisible: true
property bool isExpand: false property bool isExpand: false
property var parent property bool showEdit
property Component iconDelegate
property Component menuDelegate property Component menuDelegate
property Component editDelegate property Component editDelegate
property bool showEdit
} }

View File

@ -48,7 +48,7 @@ Item {
if(item instanceof FluPaneItemExpander){ if(item instanceof FluPaneItemExpander){
for(var j=0;j<item.children.length;j++){ for(var j=0;j<item.children.length;j++){
var itemChild = item.children[j] var itemChild = item.children[j]
itemChild.parent = item itemChild._parent = item
itemChild._idx = _idx itemChild._idx = _idx
data.push(itemChild) data.push(itemChild)
_idx++ _idx++
@ -125,8 +125,8 @@ Item {
if(!model){ if(!model){
return 1 return 1
} }
if(model.parent){ if(model._parent){
return model.parent.isExpand ? model.size : 0 return model._parent.isExpand ? model.size : 0
} }
return model.size return model.size
} }
@ -136,8 +136,8 @@ Item {
id:com_panel_item_header id:com_panel_item_header
Item{ Item{
height: { height: {
if(model.parent){ if(model._parent){
return model.parent.isExpand ? control.cellHeight : 0 return model._parent.isExpand ? control.cellHeight : 0
} }
return control.cellHeight return control.cellHeight
} }
@ -192,8 +192,13 @@ Item {
z:-100 z:-100
} }
onClicked: { onClicked: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel && model.children.length > 0){
control_popup.showPopup(Qt.point(50,mapToItem(control,0,0).y),model.children) let h = 38*Math.min(Math.max(model.children.length,1),8)
let y = mapToItem(control,0,0).y
if(h+y>control.height){
y = control.height - h
}
control_popup.showPopup(Qt.point(50,y),h,model.children)
return return
} }
model.isExpand = !model.isExpand model.isExpand = !model.isExpand
@ -261,7 +266,7 @@ Item {
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
rightMargin: 12 rightMargin: visible ? 12 : 0
} }
visible: { visible: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel){
@ -325,8 +330,14 @@ Item {
} }
Item{ Item{
id:item_icon id:item_icon
width: 30 width: visible ? 30 : 8
height: 30 height: 30
visible: {
if(model){
return model.iconVisible
}
return true
}
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:parent.left left:parent.left
@ -335,8 +346,8 @@ Item {
Loader{ Loader{
anchors.centerIn: parent anchors.centerIn: parent
sourceComponent: { sourceComponent: {
if(model&&model.cusIcon){ if(model&&model.iconDelegate){
return model.cusIcon return model.iconDelegate
} }
return com_icon return com_icon
} }
@ -346,13 +357,19 @@ Item {
id:item_title id:item_title
text:{ text:{
if(model){ if(model){
if(!item_icon.visible && d.isCompactAndNotPanel){
return model.title[0]
}
return model.title return model.title
} }
return "" return ""
} }
visible: { visible: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel){
return false if(item_icon.visible){
return false
}
return true
} }
return true return true
} }
@ -422,8 +439,8 @@ Item {
} }
} }
height: { height: {
if(model&&model.parent){ if(model&&model._parent){
return model.parent.isExpand ? control.cellHeight : 0 return model._parent.isExpand ? control.cellHeight : 0
} }
return control.cellHeight return control.cellHeight
} }
@ -561,8 +578,14 @@ Item {
} }
Item{ Item{
id:item_icon id:item_icon
width: 30
height: 30 height: 30
width: visible ? 30 : 8
visible: {
if(model){
return model.iconVisible
}
return true
}
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left:parent.left left:parent.left
@ -571,8 +594,8 @@ Item {
Loader{ Loader{
anchors.centerIn: parent anchors.centerIn: parent
sourceComponent: { sourceComponent: {
if(model&&model.cusIcon){ if(model&&model.iconDelegate){
return model.cusIcon return model.iconDelegate
} }
return com_icon return com_icon
} }
@ -582,13 +605,19 @@ Item {
id:item_title id:item_title
text:{ text:{
if(model){ if(model){
if(!item_icon.visible && d.isCompactAndNotPanel){
return model.title[0]
}
return model.title return model.title
} }
return "" return ""
} }
visible: { visible: {
if(d.isCompactAndNotPanel){ if(d.isCompactAndNotPanel){
return false if(item_icon.visible){
return false
}
return true
} }
return true return true
} }
@ -1177,14 +1206,14 @@ Item {
} }
background: FluRectangle{ background: FluRectangle{
implicitWidth: 180 implicitWidth: 180
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
radius: [4,4,4,4] radius: [4,4,4,4]
FluShadow{ FluShadow{
radius: 4 radius: 4
} }
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1) color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
} }
function showPopup(pos,model){ function showPopup(pos,height,model){
background.implicitHeight = height
control_popup.x = pos.x control_popup.x = pos.x
control_popup.y = pos.y control_popup.y = pos.y
control_popup.childModel = model control_popup.childModel = model
@ -1312,8 +1341,8 @@ Item {
return return
} }
setCurrentIndex(i) setCurrentIndex(i)
if(item.parent && !d.isCompactAndNotPanel){ if(item._parent && !d.isCompactAndNotPanel){
item.parent.isExpand = true item._parent.isExpand = true
} }
return return
} }

View File

@ -2,28 +2,28 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI import FluentUI
QtObject { QtObject {
readonly property string key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var _ext property var _ext
property var _parent
property string title property string title
property int order : 0 property int order : 0
property int icon
property var url property var url
property bool disabled: false property bool disabled: false
property Component cusIcon property int icon
property bool iconVisible: true
property Component infoBadge property Component infoBadge
property bool recentlyAdded: false property bool recentlyAdded: false
property bool recentlyUpdated: false property bool recentlyUpdated: false
property string desc property string desc
property var image property var image
property var parent
property int count: 0 property int count: 0
signal tap
property var onTapListener property var onTapListener
property Component iconDelegate
property Component menuDelegate property Component menuDelegate
property Component editDelegate property Component editDelegate
property bool showEdit property bool showEdit
signal tap
signal dropped(var drag) signal dropped(var drag)
} }

View File

@ -6,5 +6,5 @@ QtObject {
readonly property string key : FluTools.uuid() readonly property string key : FluTools.uuid()
property int _idx property int _idx
property var _ext property var _ext
property var parent property var _parent
} }

View File

@ -8,10 +8,10 @@ FluObject {
property string title property string title
property var icon property var icon
property bool disabled: false property bool disabled: false
property Component cusIcon property bool iconVisible: true
property bool isExpand: false property bool isExpand: false
property var parent property bool showEdit
property Component iconDelegate
property Component menuDelegate property Component menuDelegate
property Component editDelegate property Component editDelegate
property bool showEdit
} }