From 295dcf02c41bcb3020eed1c6bf6f521ca5c4557a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 14 Apr 2024 23:09:41 +0800 Subject: [PATCH] update --- example/example_en_US.ts | 16 ++-- example/example_zh_CN.ts | 8 +- example/qml/page/T_TreeView.qml | 80 ++++--------------- src/FluFrameless.cpp | 7 -- .../imports/FluentUI/Controls/FluTreeView.qml | 4 +- .../imports/FluentUI/Controls/FluTreeView.qml | 4 +- 6 files changed, 31 insertions(+), 88 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index e49fa5ec..f67acf47 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -2394,25 +2394,25 @@ Some contents... - + Title - + + Name + + + + Avatar - + Address - - - Name - - T_Typography diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 5f4c183e..568ee1fe 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2504,22 +2504,22 @@ Some contents... 共计选中%1条数据 - + Title 标题 - + Address 地址 - + Avatar 头像 - + Name 名称 diff --git a/example/qml/page/T_TreeView.qml b/example/qml/page/T_TreeView.qml index c1ead5f5..c98f68b2 100644 --- a/example/qml/page/T_TreeView.qml +++ b/example/qml/page/T_TreeView.qml @@ -10,7 +10,6 @@ FluContentPage { title: qsTr("TreeView") - function treeData(){ const names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"] function getRandomName(){ @@ -48,67 +47,6 @@ FluContentPage { return dig(); } - // Row{ - // id: layout_column - // spacing: 12 - // width: 340 - // anchors{ - // top:parent.top - // left: parent.left - // leftMargin: 10 - // bottom:parent.bottom - // bottomMargin: 20 - // } - // RowLayout{ - // spacing: 10 - // FluText{ - // text: "cellHeight:" - // Layout.alignment: Qt.AlignVCenter - // } - // FluSlider{ - // id: slider_cell_height - // value: 30 - // from: 30 - // to:100 - // } - // } - // RowLayout{ - // spacing: 10 - // FluText{ - // text: "depthPadding:" - // Layout.alignment: Qt.AlignVCenter - // } - // FluSlider{ - // id: slider_depth_padding - // value: 15 - // from: 15 - // to:100 - // } - // } - // FluToggleSwitch{ - // id: switch_showline - // text:"showLine" - // checked: false - // } - // FluToggleSwitch{ - // id: switch_checkable - // text:"checkable" - // checked: false - // } - // FluButton{ - // text: "all expand" - // onClicked: { - // tree_view.allExpand() - // } - // } - // FluButton{ - // text: "all collapse" - // onClicked: { - // tree_view.allCollapse() - // } - // } - // } - Component{ id:com_avatar Item{ @@ -206,7 +144,20 @@ FluContentPage { } } } - + FluButton{ + text: "print selection model" + onClicked: { + var printData = [] + var data = tree_view.selectionModel + for(var i = 0; i <= data.length-1 ; i++){ + const newObj = Object.assign({}, data[i].data); + delete newObj["__parent"]; + delete newObj["children"]; + printData.push(newObj) + } + console.debug(JSON.stringify(printData)) + } + } } } @@ -225,6 +176,9 @@ FluContentPage { showLine: switch_showline.checked checkable:switch_checkable.checked depthPadding: slider_depth_padding.value + onCurrentChanged: { + showInfo(current.data.title) + } columnSource:[ { title: qsTr("Title"), diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 0e445c26..0dd19e39 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -161,19 +161,12 @@ void FluFrameless::componentComplete() { if (!isCompositionEnabled()) { offsetSize = 0; } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) if (!isMaximum) { clientRect->top = originalTop + offsetSize; clientRect->bottom = originalBottom; clientRect->left = originalLeft; clientRect->right = originalRight; } -#else - clientRect->top = originalTop + offsetSize; - clientRect->bottom = originalBottom; - clientRect->left = originalLeft; - clientRect->right = originalRight; -#endif _setMaximizeHovered(false); *result = WVR_REDRAW; return true; diff --git a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml index 6fb81008..765d3793 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTreeView.qml @@ -12,6 +12,7 @@ Rectangle { property int cellHeight: 30 property int depthPadding: 15 property bool checkable: false + property alias selectionModel: tree_model.selectionModel property color lineColor: FluTheme.dividerColor property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property color selectedBorderColor: FluTheme.primaryColor @@ -710,9 +711,6 @@ Rectangle { } } } - function selectionModel(){ - return tree_model.selectionModel - } function count(){ return tree_model.dataSourceSize } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml index d698deea..c504b25e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTreeView.qml @@ -12,6 +12,7 @@ Rectangle { property int cellHeight: 30 property int depthPadding: 15 property bool checkable: false + property alias selectionModel: tree_model.selectionModel property color lineColor: FluTheme.dividerColor property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1) property color selectedBorderColor: FluTheme.primaryColor @@ -710,9 +711,6 @@ Rectangle { } } } - function selectionModel(){ - return tree_model.selectionModel - } function count(){ return tree_model.dataSourceSize }