From 4997b991db3238376121af5aa9e9cbe3a52c4616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 10 May 2024 19:23:30 +0800 Subject: [PATCH] update --- .../FluentUI/Controls/FluTableView.qml | 50 ++++++++++--------- .../FluentUI/Controls/FluTableView.qml | 50 ++++++++++--------- 2 files changed, 52 insertions(+), 48 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 5c559897..b398df29 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -20,6 +20,30 @@ Rectangle { property color selectedBorderColor: FluTheme.primaryColor property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) property alias view: table_view + property var columnWidthProvider: function(column) { + var columnModel = control.columnSource[column] + var width = columnModel.width + if(width){ + return width + } + var minimumWidth = columnModel.minimumWidth + if(minimumWidth){ + return minimumWidth + } + return d.defaultItemWidth + } + property var rowHeightProvider: function(row) { + var rowModel = control.getRow(row) + var height = rowModel.height + if(height){ + return height + } + var minimumHeight = rowModel._minimumHeight + if(minimumHeight){ + return minimumHeight + } + return d.defaultItemHeight + } id:control color: { if(Window.active){ @@ -438,30 +462,8 @@ Rectangle { anchors.fill: parent ScrollBar.horizontal:scroll_bar_h ScrollBar.vertical:scroll_bar_v - columnWidthProvider: function(column) { - var columnModel = control.columnSource[column] - var width = columnModel.width - if(width){ - return width - } - var minimumWidth = columnModel.minimumWidth - if(minimumWidth){ - return minimumWidth - } - return d.defaultItemWidth - } - rowHeightProvider: function(row) { - var rowModel = control.getRow(row) - var height = rowModel.height - if(height){ - return height - } - var minimumHeight = rowModel._minimumHeight - if(minimumHeight){ - return minimumHeight - } - return d.defaultItemHeight - } + columnWidthProvider: control.columnWidthProvider + rowHeightProvider: control.rowHeightProvider model: table_sort_model clip: true onRowsChanged: { diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 0e8382d7..4d3e2e53 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -20,6 +20,30 @@ Rectangle { property color selectedBorderColor: FluTheme.primaryColor property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3) property alias view: table_view + property var columnWidthProvider: function(column) { + var columnModel = control.columnSource[column] + var width = columnModel.width + if(width){ + return width + } + var minimumWidth = columnModel.minimumWidth + if(minimumWidth){ + return minimumWidth + } + return d.defaultItemWidth + } + property var rowHeightProvider: function(row) { + var rowModel = control.getRow(row) + var height = rowModel.height + if(height){ + return height + } + var minimumHeight = rowModel._minimumHeight + if(minimumHeight){ + return minimumHeight + } + return d.defaultItemHeight + } id:control color: { if(Window.active){ @@ -438,30 +462,8 @@ Rectangle { anchors.fill: parent ScrollBar.horizontal:scroll_bar_h ScrollBar.vertical:scroll_bar_v - columnWidthProvider: function(column) { - var columnModel = control.columnSource[column] - var width = columnModel.width - if(width){ - return width - } - var minimumWidth = columnModel.minimumWidth - if(minimumWidth){ - return minimumWidth - } - return d.defaultItemWidth - } - rowHeightProvider: function(row) { - var rowModel = control.getRow(row) - var height = rowModel.height - if(height){ - return height - } - var minimumHeight = rowModel._minimumHeight - if(minimumHeight){ - return minimumHeight - } - return d.defaultItemHeight - } + columnWidthProvider: control.columnWidthProvider + rowHeightProvider: control.rowHeightProvider model: table_sort_model clip: true onRowsChanged: {