From f2c2beb90ac9d2ac1ec1cd919728a4d2980b4936 Mon Sep 17 00:00:00 2001
From: Polaris-Night <158275221@qq.com>
Date: Sun, 11 May 2025 23:13:36 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20FluTableView=E5=A2=9E=E5=8A=A0startRowI?=
=?UTF-8?q?ndex=E5=B1=9E=E6=80=A7=EF=BC=8C=E4=BB=A5=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E5=88=86=E9=A1=B5=E6=95=B0=E6=8D=AE=E5=9C=BA=E6=99=AF=E4=B8=8B?=
=?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=AE=A1=E7=AE=97=E8=A1=8C=E5=BA=8F=E5=8F=B7?=
=?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E4=BB=85=E4=BE=9D=E8=B5=96=E8=A1=A8?=
=?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E9=87=8F=E8=BF=9B=E8=A1=8C=E7=BC=96?=
=?UTF-8?q?=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
example/example_en_US.ts | 16 ++++++++--------
example/example_zh_CN.ts | 16 ++++++++--------
example/qml/page/T_TableView.qml | 1 +
.../imports/FluentUI/Controls/FluTableView.qml | 12 +++++++++++-
src/Qt5/imports/FluentUI/plugins.qmltypes | 7 ++++---
.../imports/FluentUI/Controls/FluTableView.qml | 12 +++++++++++-
6 files changed, 43 insertions(+), 21 deletions(-)
diff --git a/example/example_en_US.ts b/example/example_en_US.ts
index 802e0585..a4886c29 100644
--- a/example/example_en_US.ts
+++ b/example/example_en_US.ts
@@ -2368,7 +2368,7 @@ Some contents...
-
+
Name
@@ -2418,37 +2418,37 @@ Some contents...
-
+
Avatar
-
+
Address
-
+
Nickname
-
+
Long String
-
+
Options
-
+
<Previous
-
+
Next>
diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts
index 00981b6d..5d1d3c5d 100644
--- a/example/example_zh_CN.ts
+++ b/example/example_zh_CN.ts
@@ -2557,7 +2557,7 @@ Some contents...
-
+
Name
名称
@@ -2597,37 +2597,37 @@ Some contents...
焦点未获取:请点击表格中的任意一项,作为插入的靶点!
-
+
Avatar
头像
-
+
Address
地址
-
+
Nickname
昵称
-
+
Long String
长字符串
-
+
Options
操作
-
+
<Previous
<上一页
-
+
Next>
下一页>
diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml
index 242fdb4b..e9681387 100644
--- a/example/qml/page/T_TableView.qml
+++ b/example/qml/page/T_TableView.qml
@@ -493,6 +493,7 @@ FluContentPage{
onRowsChanged: {
root.checkBoxChanged()
}
+ startRowIndex: (gagination.pageCurrent - 1) * gagination.__itemPerPage + 1
columnSource:[
{
title: table_view.customItem(com_column_checbox,{checked:true}),
diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml
index 6fb39b4f..c1beabbe 100644
--- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml
+++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml
@@ -17,6 +17,7 @@ Rectangle {
property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1)
property bool horizonalHeaderVisible: true
property bool verticalHeaderVisible: true
+ property int startRowIndex: 1
property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3)
property alias view: table_view
@@ -841,7 +842,13 @@ Rectangle {
Connections{
target: table_view
function onRowsChanged(){
- header_row_model.rows = Array.from({length: table_view.rows}, (_, i) => ({rowIndex:i+1}))
+ header_vertical.updateRowIndex()
+ }
+ }
+ Connections {
+ target: control
+ function onStartRowIndexChanged(){
+ header_vertical.updateRowIndex()
}
}
Timer{
@@ -851,6 +858,9 @@ Rectangle {
header_vertical.forceLayout()
}
}
+ function updateRowIndex(){
+ header_row_model.rows = Array.from({length: table_view.rows}, (_, i) => ({rowIndex:i+control.startRowIndex}))
+ }
}
Item{
anchors{
diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes
index 17e31c99..ffeabf87 100644
--- a/src/Qt5/imports/FluentUI/plugins.qmltypes
+++ b/src/Qt5/imports/FluentUI/plugins.qmltypes
@@ -2778,7 +2778,7 @@ Module {
}
Property {
name: "layoutMacosButtons"
- type: "FluLoader_QMLTYPE_11"
+ type: "FluLoader_QMLTYPE_12"
isReadonly: true
isPointer: true
}
@@ -3486,8 +3486,8 @@ Module {
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "topPadding"; type: "int" }
Property { name: "pageMode"; type: "int" }
- Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_37"; isPointer: true }
- Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_37"; isPointer: true }
+ Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_49"; isPointer: true }
+ Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_49"; isPointer: true }
Property { name: "navCompactWidth"; type: "int" }
Property { name: "navTopMargin"; type: "int" }
Property { name: "cellHeight"; type: "int" }
@@ -4092,6 +4092,7 @@ Module {
Property { name: "borderColor"; type: "QColor" }
Property { name: "horizonalHeaderVisible"; type: "bool" }
Property { name: "verticalHeaderVisible"; type: "bool" }
+ Property { name: "startRowIndex"; type: "int" }
Property { name: "selectedBorderColor"; type: "QColor" }
Property { name: "selectedColor"; type: "QColor" }
Property { name: "columnWidthProvider"; type: "QVariant" }
diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml
index 100be1d9..ebb50392 100644
--- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml
+++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml
@@ -17,6 +17,7 @@ Rectangle {
property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1)
property bool horizonalHeaderVisible: true
property bool verticalHeaderVisible: true
+ property int startRowIndex: 1
property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3)
property alias view: table_view
@@ -841,7 +842,13 @@ Rectangle {
Connections{
target: table_view
function onRowsChanged(){
- header_row_model.rows = Array.from({length: table_view.rows}, (_, i) => ({rowIndex:i+1}))
+ header_vertical.updateRowIndex()
+ }
+ }
+ Connections {
+ target: control
+ function onStartRowIndexChanged(){
+ header_vertical.updateRowIndex()
}
}
Timer{
@@ -851,6 +858,9 @@ Rectangle {
header_vertical.forceLayout()
}
}
+ function updateRowIndex(){
+ header_row_model.rows = Array.from({length: table_view.rows}, (_, i) => ({rowIndex:i+control.startRowIndex}))
+ }
}
Item{
anchors{