diff --git a/example/qml-Qt6/global/ItemsOriginal.qml b/example/qml-Qt6/global/ItemsOriginal.qml index 55d4520e..1b6a0c1f 100644 --- a/example/qml-Qt6/global/ItemsOriginal.qml +++ b/example/qml-Qt6/global/ItemsOriginal.qml @@ -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 diff --git a/example/qml-Qt6/window/MainWindow.qml b/example/qml-Qt6/window/MainWindow.qml index bf56c5d5..ec575ddc 100644 --- a/example/qml-Qt6/window/MainWindow.qml +++ b/example/qml-Qt6/window/MainWindow.qml @@ -39,7 +39,6 @@ FluWindow { } } Component.onCompleted: { - console.debug(Lang.about) FluTools.setQuitOnLastWindowClosed(false) tour.open() checkUpdate(true) diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml index 5f06ab0c..3ddeab46 100644 --- a/example/qml/global/ItemsOriginal.qml +++ b/example/qml/global/ItemsOriginal.qml @@ -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 diff --git a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml index 9ecd0e01..93a2c1ae 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml @@ -47,7 +47,7 @@ Item { if(item instanceof FluPaneItemExpander){ for(var j=0;j 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,13 +356,19 @@ 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){ - return false + if(item_icon.visible){ + return false + } + return true } return true } @@ -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,13 +604,19 @@ 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){ - return false + if(item_icon.visible){ + return false + } + return true } return true } @@ -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 } diff --git a/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml b/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml index abf0975c..8514789b 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPaneItem.qml @@ -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) } + diff --git a/src/Qt5/imports/FluentUI/Controls/FluPaneItemEmpty.qml b/src/Qt5/imports/FluentUI/Controls/FluPaneItemEmpty.qml index 92bb64c6..5a33c983 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPaneItemEmpty.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPaneItemEmpty.qml @@ -6,5 +6,5 @@ QtObject { readonly property string key : FluTools.uuid() property int _idx property var _ext - property var parent + property var _parent } diff --git a/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml b/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml index 4d97f812..07818e61 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPaneItemExpander.qml @@ -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 } diff --git a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml index fcd3907b..4c390207 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml @@ -48,7 +48,7 @@ Item { if(item instanceof FluPaneItemExpander){ for(var j=0;j 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,13 +357,19 @@ 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){ - return false + if(item_icon.visible){ + return false + } + return true } return true } @@ -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,13 +605,19 @@ 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){ - return false + if(item_icon.visible){ + return false + } + return true } return true } @@ -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 } diff --git a/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml b/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml index f51726db..92af6b8c 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPaneItem.qml @@ -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) } diff --git a/src/Qt6/imports/FluentUI/Controls/FluPaneItemEmpty.qml b/src/Qt6/imports/FluentUI/Controls/FluPaneItemEmpty.qml index 04a1a44b..79258f51 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPaneItemEmpty.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPaneItemEmpty.qml @@ -6,5 +6,5 @@ QtObject { readonly property string key : FluTools.uuid() property int _idx property var _ext - property var parent + property var _parent } diff --git a/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml b/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml index a152d010..10ef7309 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPaneItemExpander.qml @@ -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 }