解决FluTableView快速滚动卡顿问题

This commit is contained in:
朱子楚\zhuzi 2024-03-18 18:26:37 +08:00
parent 0e7606b646
commit d01f9019c0
2 changed files with 32 additions and 28 deletions

View File

@ -345,10 +345,21 @@ Rectangle {
id:model_columns id:model_columns
} }
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
syncView: header_horizontal
syncDirection: Qt.Horizontal
anchors.fill: parent anchors.fill: parent
contentX: header_horizontal.contentX
ScrollBar.vertical:scroll_bar_v ScrollBar.vertical:scroll_bar_v
columnWidthProvider: function(column) {
var columnObject = d.columns_data[column]
var width = columnObject.width
if(width){
return width
}
var minimumWidth = columnObject.minimumWidth
if(minimumWidth){
return minimumWidth
}
return d.defaultItemWidth
}
rowHeightProvider: function(row) { rowHeightProvider: function(row) {
var rowObject = control.getRow(row) var rowObject = control.getRow(row)
var height = rowObject.height var height = rowObject.height
@ -542,6 +553,7 @@ Rectangle {
maximumWidth = 65535 maximumWidth = 65535
} }
columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth)
table_view.forceLayout()
header_horizontal.forceLayout() header_horizontal.forceLayout()
} }
} }
@ -719,19 +731,9 @@ Rectangle {
height: visible ? Math.max(1, contentHeight) : 0 height: visible ? Math.max(1, contentHeight) : 0
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
contentX: table_view.contentX
columnWidthProvider: table_view.columnWidthProvider
ScrollBar.horizontal:scroll_bar_h ScrollBar.horizontal:scroll_bar_h
columnWidthProvider: function(column) {
var columnObject = d.columns_data[column]
var width = columnObject.width
if(width){
return width
}
var minimumWidth = columnObject.minimumWidth
if(minimumWidth){
return minimumWidth
}
return d.defaultItemWidth
}
onContentXChanged:{ onContentXChanged:{
timer_horizontal_force_layout.restart() timer_horizontal_force_layout.restart()
} }

View File

@ -346,10 +346,21 @@ Rectangle {
id:model_columns id:model_columns
} }
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
syncView: header_horizontal
syncDirection: Qt.Horizontal
anchors.fill: parent anchors.fill: parent
contentX: header_horizontal.contentX
ScrollBar.vertical:scroll_bar_v ScrollBar.vertical:scroll_bar_v
columnWidthProvider: function(column) {
var columnObject = d.columns_data[column]
var width = columnObject.width
if(width){
return width
}
var minimumWidth = columnObject.minimumWidth
if(minimumWidth){
return minimumWidth
}
return d.defaultItemWidth
}
rowHeightProvider: function(row) { rowHeightProvider: function(row) {
var rowObject = control.getRow(row) var rowObject = control.getRow(row)
var height = rowObject.height var height = rowObject.height
@ -543,6 +554,7 @@ Rectangle {
maximumWidth = 65535 maximumWidth = 65535
} }
columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth)
table_view.forceLayout()
header_horizontal.forceLayout() header_horizontal.forceLayout()
} }
} }
@ -720,19 +732,9 @@ Rectangle {
height: visible ? Math.max(1, contentHeight) : 0 height: visible ? Math.max(1, contentHeight) : 0
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
clip: true clip: true
contentX: table_view.contentX
columnWidthProvider: table_view.columnWidthProvider
ScrollBar.horizontal:scroll_bar_h ScrollBar.horizontal:scroll_bar_h
columnWidthProvider: function(column) {
var columnObject = d.columns_data[column]
var width = columnObject.width
if(width){
return width
}
var minimumWidth = columnObject.minimumWidth
if(minimumWidth){
return minimumWidth
}
return d.defaultItemWidth
}
onContentXChanged:{ onContentXChanged:{
timer_horizontal_force_layout.restart() timer_horizontal_force_layout.restart()
} }