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{
id:item_expander_basic_input
title:Lang.basic_input
@ -381,12 +387,6 @@ FluObject{
}
}
FluPaneItemExpander{
title:"PaneItemExpander Disabled"
icon: FluentIcons.Send
disabled: true
}
FluPaneItemSeparator{
spacing:10
size:1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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