Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed May 5, 2024
1 parent 394a42c commit fe2543a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/Qt5/imports/FluentUI/Controls/FluTableView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Rectangle {
property bool verticalHeaderVisible: true
property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3)
property alias view: table_view
id:control
color: {
if(Window.active){
Expand Down Expand Up @@ -47,6 +48,9 @@ Rectangle {
header_column_model.rows = [headerRow]
}
}
Component.onDestruction: {
table_view.contentY = 0
}
QtObject{
id:d
property var current
Expand Down Expand Up @@ -896,6 +900,7 @@ Rectangle {
item_table_frozen_header.contentX = columnModel.width * _index
item_table_frozen.contentX = columnModel.width * _index
}

}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/Qt5/imports/FluentUI/Controls/FluTreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ Rectangle {
id:tree_model
columnSource: control.columnSource
}
Component.onDestruction: {
table_view.contentY = 0
}
onDepthPaddingChanged: {
table_view.forceLayout()
}
Expand Down
5 changes: 5 additions & 0 deletions src/Qt6/imports/FluentUI/Controls/FluTableView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Rectangle {
property bool verticalHeaderVisible: true
property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3)
property alias view: table_view
id:control
color: {
if(Window.active){
Expand Down Expand Up @@ -47,6 +48,9 @@ Rectangle {
header_column_model.rows = [headerRow]
}
}
Component.onDestruction: {
table_view.contentY = 0
}
QtObject{
id:d
property var current
Expand Down Expand Up @@ -896,6 +900,7 @@ Rectangle {
item_table_frozen_header.contentX = columnModel.width * _index
item_table_frozen.contentX = columnModel.width * _index
}

}
}
}
Expand Down
25 changes: 15 additions & 10 deletions src/Qt6/imports/FluentUI/Controls/FluTreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,26 @@ Rectangle {
tree_model.setDataSource(dataSource)
}
onColumnSourceChanged: {
var columns= []
var headerRow = {}
columnSource.forEach(function(item){
var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',control);
column.display = item.dataIndex
columns.push(column)
headerRow[item.dataIndex] = item.title
})
header_column_model.columns = columns
header_column_model.rows = [headerRow]
if(columnSource.length !== 0){
var columns= []
var headerRow = {}
columnSource.forEach(function(item){
var column = Qt.createQmlObject('import Qt.labs.qmlmodels 1.0;TableModelColumn{}',control);
column.display = item.dataIndex
columns.push(column)
headerRow[item.dataIndex] = item.title
})
header_column_model.columns = columns
header_column_model.rows = [headerRow]
}
}
FluTreeModel{
id:tree_model
columnSource: control.columnSource
}
Component.onDestruction: {
table_view.contentY = 0
}
onDepthPaddingChanged: {
table_view.forceLayout()
}
Expand Down

0 comments on commit fe2543a

Please sign in to comment.