From d01f9019c0b727e371e70a679b51a7a149bcc67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Mon, 18 Mar 2024 18:26:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3FluTableView=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E6=BB=9A=E5=8A=A8=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FluentUI/Controls/FluTableView.qml | 30 ++++++++++--------- .../FluentUI/Controls/FluTableView.qml | 30 ++++++++++--------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 7a27beb5..4afe9e6a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -345,10 +345,21 @@ Rectangle { id:model_columns } boundsBehavior: Flickable.StopAtBounds - syncView: header_horizontal - syncDirection: Qt.Horizontal anchors.fill: parent + contentX: header_horizontal.contentX 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) { var rowObject = control.getRow(row) var height = rowObject.height @@ -542,6 +553,7 @@ Rectangle { maximumWidth = 65535 } columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) + table_view.forceLayout() header_horizontal.forceLayout() } } @@ -719,19 +731,9 @@ Rectangle { height: visible ? Math.max(1, contentHeight) : 0 boundsBehavior: Flickable.StopAtBounds clip: true + contentX: table_view.contentX + columnWidthProvider: table_view.columnWidthProvider 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:{ timer_horizontal_force_layout.restart() } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 2acda1f5..d3ae14e2 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -346,10 +346,21 @@ Rectangle { id:model_columns } boundsBehavior: Flickable.StopAtBounds - syncView: header_horizontal - syncDirection: Qt.Horizontal anchors.fill: parent + contentX: header_horizontal.contentX 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) { var rowObject = control.getRow(row) var height = rowObject.height @@ -543,6 +554,7 @@ Rectangle { maximumWidth = 65535 } columnObject.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth) + table_view.forceLayout() header_horizontal.forceLayout() } } @@ -720,19 +732,9 @@ Rectangle { height: visible ? Math.max(1, contentHeight) : 0 boundsBehavior: Flickable.StopAtBounds clip: true + contentX: table_view.contentX + columnWidthProvider: table_view.columnWidthProvider 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:{ timer_horizontal_force_layout.restart() }