From 49e96b094b780c1b625af349bb5bc0107fa28d61 Mon Sep 17 00:00:00 2001 From: Polaris-Night <158275221@qq.com> Date: Sat, 10 May 2025 20:38:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20FluRectangle=E6=94=AF=E6=8C=81borde?= =?UTF-8?q?r=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/qml/page/T_Rectangle.qml | 18 +++++++ src/FluRectangle.cpp | 62 ++++++++++++++++------- src/FluRectangle.h | 4 ++ src/Qt5/imports/FluentUI/plugins.qmltypes | 17 +++++-- 4 files changed, 79 insertions(+), 22 deletions(-) diff --git a/example/qml/page/T_Rectangle.qml b/example/qml/page/T_Rectangle.qml index edd8d153..08a016ca 100644 --- a/example/qml/page/T_Rectangle.qml +++ b/example/qml/page/T_Rectangle.qml @@ -58,6 +58,22 @@ FluScrollablePage{ color:"#b4009e" radius:[0,0,0,15] } + FluRectangle{ + width: 50 + height: 50 + color:"#a8d5ba" + radius:[15,15,15,15] + borderWidth: 3 + borderColor: "#5b8a72" + } + FluRectangle{ + width: 50 + height: 50 + color:"#dbe2ef" + radius:[15,0,0,0] + borderWidth: 2 + borderColor: "#3f72af" + } } } } @@ -66,6 +82,8 @@ FluScrollablePage{ Layout.topMargin: -6 code:'FluRectangle{ radius: [25,25,25,25] + borderWidth: 2 + borderColor: "#000000" width: 50 height: 50 }' diff --git a/src/FluRectangle.cpp b/src/FluRectangle.cpp index 00890a76..fdd69d5f 100644 --- a/src/FluRectangle.cpp +++ b/src/FluRectangle.cpp @@ -2,33 +2,61 @@ #include FluRectangle::FluRectangle(QQuickItem *parent) : QQuickPaintedItem(parent) { - color(QColor(255, 255, 255, 255)); + color(Qt::white); radius({0, 0, 0, 0}); + borderWidth(0); + borderColor(Qt::black); connect(this, &FluRectangle::colorChanged, this, [=] { update(); }); connect(this, &FluRectangle::radiusChanged, this, [=] { update(); }); + connect(this, &FluRectangle::borderWidthChanged, this, [=] { update(); }); + connect(this, &FluRectangle::borderColorChanged, this, [=] { update(); }); } +bool FluRectangle::borderValid() const { + return qRound(_borderWidth) >= 1 && _color.isValid() && _color.alpha() > 0; +} void FluRectangle::paint(QPainter *painter) { painter->save(); painter->setRenderHint(QPainter::Antialiasing); - QPainterPath path; + QRectF rect = boundingRect(); - path.moveTo(rect.bottomRight() - QPointF(0, _radius[2])); - path.lineTo(rect.topRight() + QPointF(0, _radius[1])); - path.arcTo(QRectF(QPointF(rect.topRight() - QPointF(_radius[1] * 2, 0)), - QSize(_radius[1] * 2, _radius[1] * 2)), - 0, 90); - path.lineTo(rect.topLeft() + QPointF(_radius[0], 0)); - path.arcTo(QRectF(QPointF(rect.topLeft()), QSize(_radius[0] * 2, _radius[0] * 2)), 90, 90); - path.lineTo(rect.bottomLeft() - QPointF(0, _radius[3])); - path.arcTo(QRectF(QPointF(rect.bottomLeft() - QPointF(0, _radius[3] * 2)), - QSize(_radius[3] * 2, _radius[3] * 2)), - 180, 90); - path.lineTo(rect.bottomRight() - QPointF(_radius[2], 0)); - path.arcTo(QRectF(QPointF(rect.bottomRight() - QPointF(_radius[2] * 2, _radius[2] * 2)), - QSize(_radius[2] * 2, _radius[2] * 2)), - 270, 90); + bool valid = borderValid(); + if (valid) { + // 绘制边框时画笔的宽度从路径向两侧扩充 + // 因此实际绘制的矩形应向内侧收缩边框宽度的一半,避免边框裁剪导致不完整 + qreal halfBorderWidth = _borderWidth / 2.0; + rect.adjust(halfBorderWidth, halfBorderWidth, -halfBorderWidth, -halfBorderWidth); + } + + QPainterPath path; + QList r = _radius; + + while (r.size() < 4) { + r.append(0); + } + + // 从右下角开始逆时针绘制圆角矩形路径 + path.moveTo(rect.bottomRight() - QPointF(0, r[2])); + path.lineTo(rect.topRight() + QPointF(0, r[1])); + path.arcTo(QRectF(QPointF(rect.topRight() - QPointF(r[1] * 2, 0)), QSize(r[1] * 2, r[1] * 2)), 0, 90); + + path.lineTo(rect.topLeft() + QPointF(r[0], 0)); + path.arcTo(QRectF(QPointF(rect.topLeft()), QSize(r[0] * 2, r[0] * 2)), 90, 90); + + path.lineTo(rect.bottomLeft() - QPointF(0, r[3])); + path.arcTo(QRectF(QPointF(rect.bottomLeft() - QPointF(0, r[3] * 2)), QSize(r[3] * 2, r[3] * 2)), 180, 90); + + path.lineTo(rect.bottomRight() - QPointF(r[2], 0)); + path.arcTo(QRectF(QPointF(rect.bottomRight() - QPointF(r[2] * 2, r[2] * 2)), QSize(r[2] * 2, r[2] * 2)), 270, 90); + + // 填充背景 painter->fillPath(path, _color); + + // 绘制边框 + if (valid) { + painter->strokePath(path, QPen(_borderColor, _borderWidth)); + } + painter->restore(); } diff --git a/src/FluRectangle.h b/src/FluRectangle.h index 4690ff39..571af4f6 100644 --- a/src/FluRectangle.h +++ b/src/FluRectangle.h @@ -12,9 +12,13 @@ class FluRectangle : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY_AUTO(QColor, color) Q_PROPERTY_AUTO(QList, radius) + Q_PROPERTY_AUTO(qreal, borderWidth) + Q_PROPERTY_AUTO(QColor, borderColor) QML_NAMED_ELEMENT(FluRectangle) public: explicit FluRectangle(QQuickItem *parent = nullptr); + bool borderValid() const; + void paint(QPainter *painter) override; }; diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index 26d694db..17e31c99 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -231,6 +231,8 @@ Module { exportMetaObjectRevisions: [0] Property { name: "color"; type: "QColor" } Property { name: "radius"; type: "QList" } + Property { name: "borderWidth"; type: "double" } + Property { name: "borderColor"; type: "QColor" } } Component { name: "FluSheetType" @@ -2776,7 +2778,7 @@ Module { } Property { name: "layoutMacosButtons" - type: "FluLoader_QMLTYPE_14" + type: "FluLoader_QMLTYPE_11" isReadonly: true isPointer: true } @@ -2797,12 +2799,16 @@ Module { Property { name: "items"; type: "QVariant" } Property { name: "emptyText"; type: "string" } Property { name: "autoSuggestBoxReplacement"; type: "int" } + Property { name: "itemHeight"; type: "int" } + Property { name: "itemRows"; type: "int" } + Property { name: "showSuggestWhenPressed"; type: "bool" } Property { name: "textRole"; type: "string" } Property { name: "filter"; type: "QVariant" } Signal { name: "itemClicked" Parameter { name: "data"; type: "QVariant" } } + Method { name: "showSuggest"; type: "QVariant" } Method { name: "updateText" type: "QVariant" @@ -2830,8 +2836,9 @@ Module { defaultProperty: "data" Property { name: "isDot"; type: "bool" } Property { name: "showZero"; type: "bool" } - Property { name: "count"; type: "int" } - Property { name: "topRight"; type: "bool" } + Property { name: "count"; type: "QVariant" } + Property { name: "max"; type: "int" } + Property { name: "position"; type: "string" } } Component { prototype: "QQuickItem" @@ -3479,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_47"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_37"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_37"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } From b2fd3acda33c31cdd029eaa9b523a0ef75f9f31a Mon Sep 17 00:00:00 2001 From: Polaris-Night <158275221@qq.com> Date: Sun, 11 May 2025 22:18:37 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20FluDatePicker=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=9C=88=E4=BB=BD=E6=97=B6=EF=BC=8C=E8=8B=A5=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=97=A5=E5=AD=98=E5=9C=A8=E4=BA=8E=E6=96=B0=E7=9A=84=E6=9C=88?= =?UTF-8?q?=E4=BB=BD=E4=B8=AD=E5=88=99=E4=BF=9D=E6=8C=81=E6=97=A5=E4=B8=8D?= =?UTF-8?q?=E5=8F=98=EF=BC=8C=E5=90=A6=E5=88=99=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=96=B0=E6=9C=88=E4=BB=BD=E7=9A=84=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml | 5 +++++ src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml b/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml index 1ba43afa..b2f4e96d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluDatePicker.qml @@ -178,7 +178,12 @@ FluButton { } if(type === 1){ text_month.text = model + let day = list_view_3.model[list_view_3.currentIndex] list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) + if(list_view_3.model.indexOf(day) === -1){ + day = list_view_3.model[list_view_3.model.length - 1] + } + list_view_3.currentIndex = list_view_3.model.indexOf(day) text_day.text = list_view_3.model[list_view_3.currentIndex] } diff --git a/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml b/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml index 7afd1ca3..3c3a2ac5 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluDatePicker.qml @@ -178,7 +178,12 @@ FluButton { } if(type === 1){ text_month.text = model + let day = list_view_3.model[list_view_3.currentIndex] list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex]) + if(list_view_3.model.indexOf(day) === -1){ + day = list_view_3.model[list_view_3.model.length - 1] + } + list_view_3.currentIndex = list_view_3.model.indexOf(day) text_day.text = list_view_3.model[list_view_3.currentIndex] } From a787a733c41e51aad89eedc1179649fd721be176 Mon Sep 17 00:00:00 2001 From: Polaris-Night <158275221@qq.com> Date: Sun, 11 May 2025 22:27:48 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E9=83=A8=E5=88=86=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E7=94=A8enabled=E6=9B=BF=E4=BB=A3disabled=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E4=BD=BF=E7=94=A8=E5=8E=9F=E7=94=9Fenabled=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=97=B6=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Qt5/imports/FluentUI/Controls/FluComboBox.qml | 4 ++-- src/Qt5/imports/FluentUI/Controls/FluMenuBarItem.qml | 4 ++-- src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml | 4 ++-- src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml | 2 +- src/Qt6/imports/FluentUI/Controls/FluComboBox.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluMenuBarItem.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml index 3000cc7c..1792f911 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml @@ -55,7 +55,7 @@ T.ComboBox { font:control.font readOnly: control.down color: { - if(control.disabled) { + if(!control.enabled) { return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) } return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) @@ -97,7 +97,7 @@ T.ComboBox { anchors.margins: -2 } color:{ - if(disabled){ + if(!enabled){ return disableColor } return hovered ? hoverColor :normalColor diff --git a/src/Qt5/imports/FluentUI/Controls/FluMenuBarItem.qml b/src/Qt5/imports/FluentUI/Controls/FluMenuBarItem.qml index e772314f..4d366fcf 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluMenuBarItem.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluMenuBarItem.qml @@ -6,7 +6,7 @@ T.MenuBarItem { property bool disabled: false property color textColor: { if(FluTheme.dark){ - if(disabled){ + if(!enabled){ return Qt.rgba(131/255,131/255,131/255,1) } if(pressed){ @@ -14,7 +14,7 @@ T.MenuBarItem { } return Qt.rgba(1,1,1,1) }else{ - if(disabled){ + if(!enabled){ return Qt.rgba(160/255,160/255,160/255,1) } if(pressed){ diff --git a/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml b/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml index 2f562e35..bd3ab1aa 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluSpinBox.qml @@ -139,13 +139,13 @@ T.SpinBox { radius: 4 border.width: 1 border.color: { - if(contentItem.disabled){ + if(!contentItem.enabled){ return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1) } return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1) } color: { - if(contentItem.disabled){ + if(!contentItem.enabled){ return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) } if(contentItem.activeFocus){ diff --git a/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml b/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml index ef82bd13..3467a621 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTextBoxBackground.qml @@ -6,7 +6,7 @@ FluControlBackground{ property Item inputItem id:control color: { - if(inputItem && inputItem.disabled){ + if(inputItem && !inputItem.enabled){ return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) } if(inputItem && inputItem.activeFocus){ diff --git a/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml index 6dc161b1..6a8662c4 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml @@ -55,7 +55,7 @@ T.ComboBox { font:control.font readOnly: control.down color: { - if(control.disabled) { + if(!control.enabled) { return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) } return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) @@ -97,7 +97,7 @@ T.ComboBox { anchors.margins: -2 } color:{ - if(disabled){ + if(!enabled){ return disableColor } return hovered ? hoverColor :normalColor diff --git a/src/Qt6/imports/FluentUI/Controls/FluMenuBarItem.qml b/src/Qt6/imports/FluentUI/Controls/FluMenuBarItem.qml index 03e06cf0..9e0c6891 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluMenuBarItem.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluMenuBarItem.qml @@ -7,7 +7,7 @@ T.MenuBarItem { property bool disabled: false property color textColor: { if(FluTheme.dark){ - if(disabled){ + if(!enabled){ return Qt.rgba(131/255,131/255,131/255,1) } if(pressed){ @@ -15,7 +15,7 @@ T.MenuBarItem { } return Qt.rgba(1,1,1,1) }else{ - if(disabled){ + if(!enabled){ return Qt.rgba(160/255,160/255,160/255,1) } if(pressed){ diff --git a/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml b/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml index 7dcc6294..335d73eb 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluSpinBox.qml @@ -140,13 +140,13 @@ T.SpinBox { radius: 4 border.width: 1 border.color: { - if(contentItem.disabled){ + if(!contentItem.enabled){ return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1) } return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1) } color: { - if(contentItem.disabled){ + if(!contentItem.enabled){ return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) } if(contentItem.activeFocus){ diff --git a/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml b/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml index a57cff5a..44a4604e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTextBoxBackground.qml @@ -6,7 +6,7 @@ FluControlBackground{ property Item inputItem id:control color: { - if(inputItem && inputItem.disabled){ + if(inputItem && !inputItem.enabled){ return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) } if(inputItem && inputItem.activeFocus){ 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 4/4] =?UTF-8?q?feat:=20FluTableView=E5=A2=9E=E5=8A=A0start?= =?UTF-8?q?RowIndex=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{