Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Apr 14, 2024
1 parent f701f97 commit 295dcf0
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 87 deletions.
14 changes: 7 additions & 7 deletions example/example_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2394,23 +2394,23 @@ Some contents...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="230"/>
<location filename="qml/page/T_TreeView.qml" line="184"/>
<source>Title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="238"/>
<source>Avatar</source>
<location filename="qml/page/T_TreeView.qml" line="188"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="242"/>
<source>Address</source>
<location filename="qml/page/T_TreeView.qml" line="192"/>
<source>Avatar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="234"/>
<source>Name</source>
<location filename="qml/page/T_TreeView.qml" line="196"/>
<source>Address</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
8 changes: 4 additions & 4 deletions example/example_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2504,22 +2504,22 @@ Some contents...</source>
<translation type="obsolete">共计选中%1条数据</translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="230"/>
<location filename="qml/page/T_TreeView.qml" line="184"/>
<source>Title</source>
<translation type="unfinished">标题</translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="242"/>
<location filename="qml/page/T_TreeView.qml" line="196"/>
<source>Address</source>
<translation type="unfinished">地址</translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="238"/>
<location filename="qml/page/T_TreeView.qml" line="192"/>
<source>Avatar</source>
<translation type="unfinished">头像</translation>
</message>
<message>
<location filename="qml/page/T_TreeView.qml" line="234"/>
<location filename="qml/page/T_TreeView.qml" line="188"/>
<source>Name</source>
<translation type="unfinished">名称</translation>
</message>
Expand Down
80 changes: 17 additions & 63 deletions example/qml/page/T_TreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ FluContentPage {
title: qsTr("TreeView")



function treeData(){
const names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"]
function getRandomName(){
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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))
}
}
}
}

Expand All @@ -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"),
Expand Down
7 changes: 0 additions & 7 deletions src/FluFrameless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/Qt5/imports/FluentUI/Controls/FluTreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -710,9 +711,6 @@ Rectangle {
}
}
}
function selectionModel(){
return tree_model.selectionModel
}
function count(){
return tree_model.dataSourceSize
}
Expand Down
4 changes: 1 addition & 3 deletions src/Qt6/imports/FluentUI/Controls/FluTreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -710,9 +711,6 @@ Rectangle {
}
}
}
function selectionModel(){
return tree_model.selectionModel
}
function count(){
return tree_model.dataSourceSize
}
Expand Down

0 comments on commit 295dcf0

Please sign in to comment.