This commit is contained in:
朱子楚\zhuzi 2024-05-05 22:03:41 +08:00
parent 394a42cb94
commit fe2543ab4d
4 changed files with 28 additions and 10 deletions

View File

@ -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){
@ -47,6 +48,9 @@ Rectangle {
header_column_model.rows = [headerRow]
}
}
Component.onDestruction: {
table_view.contentY = 0
}
QtObject{
id:d
property var current
@ -896,6 +900,7 @@ Rectangle {
item_table_frozen_header.contentX = columnModel.width * _index
item_table_frozen.contentX = columnModel.width * _index
}
}
}
}

View File

@ -45,6 +45,9 @@ Rectangle {
id:tree_model
columnSource: control.columnSource
}
Component.onDestruction: {
table_view.contentY = 0
}
onDepthPaddingChanged: {
table_view.forceLayout()
}

View File

@ -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){
@ -47,6 +48,9 @@ Rectangle {
header_column_model.rows = [headerRow]
}
}
Component.onDestruction: {
table_view.contentY = 0
}
QtObject{
id:d
property var current
@ -896,6 +900,7 @@ Rectangle {
item_table_frozen_header.contentX = columnModel.width * _index
item_table_frozen.contentX = columnModel.width * _index
}
}
}
}

View File

@ -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()
}