From 294606d019e219fc5dbe960b35ab1026d7fe52ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Thu, 29 Jun 2023 22:30:15 +0800 Subject: [PATCH] update --- example/qml/page/T_TableView.qml | 2 +- src/imports/FluentUI/Controls/FluComboBox.qml | 4 +-- .../FluentUI/Controls/FluCopyableText.qml | 4 +-- .../FluentUI/Controls/FluMultilineTextBox.qml | 3 +- .../FluentUI/Controls/FluPasswordBox.qml | 3 +- .../FluentUI/Controls/FluTableView.qml | 28 ++++++++++++++++--- src/imports/FluentUI/Controls/FluTextBox.qml | 3 +- 7 files changed, 35 insertions(+), 12 deletions(-) diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml index 1eaf6619..fefe4ff9 100644 --- a/example/qml/page/T_TableView.qml +++ b/example/qml/page/T_TableView.qml @@ -63,7 +63,7 @@ FluContentPage{ age:getRandomAge(), address: getRandomAddresses(), nickname: getRandomNickname(), - longstring:"测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试", + longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好", height:46, minimumHeight:46, maximumHeight:300, diff --git a/src/imports/FluentUI/Controls/FluComboBox.qml b/src/imports/FluentUI/Controls/FluComboBox.qml index a19770dc..cae479e9 100644 --- a/src/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/imports/FluentUI/Controls/FluComboBox.qml @@ -44,8 +44,8 @@ ComboBox { topPadding: 6 - control.padding bottomPadding: 6 - control.padding renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering - selectionColor: FluTheme.primaryColor.lightest - selectedTextColor: control.palette.highlightedText + selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) + selectedTextColor: color text: control.editable ? control.editText : control.displayText enabled: control.editable autoScroll: control.editable diff --git a/src/imports/FluentUI/Controls/FluCopyableText.qml b/src/imports/FluentUI/Controls/FluCopyableText.qml index 3b339175..215683bf 100644 --- a/src/imports/FluentUI/Controls/FluCopyableText.qml +++ b/src/imports/FluentUI/Controls/FluCopyableText.qml @@ -15,9 +15,9 @@ TextEdit { rightPadding: 0 topPadding: 0 selectByMouse: true - selectedTextColor: FluColors.Grey220 + selectedTextColor: color bottomPadding: 0 - selectionColor: FluTheme.primaryColor.lightest + selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) font:FluTextStyle.Body onSelectedTextChanged: { control.forceActiveFocus() diff --git a/src/imports/FluentUI/Controls/FluMultilineTextBox.qml b/src/imports/FluentUI/Controls/FluMultilineTextBox.qml index 89f8f959..ee2c3a85 100644 --- a/src/imports/FluentUI/Controls/FluMultilineTextBox.qml +++ b/src/imports/FluentUI/Controls/FluMultilineTextBox.qml @@ -23,7 +23,8 @@ TextArea{ font:FluTextStyle.Body wrapMode: Text.WrapAnywhere renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering - selectionColor: FluTheme.primaryColor.lightest + selectedTextColor: color + selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) placeholderTextColor: { if(!enabled){ return placeholderDisableColor diff --git a/src/imports/FluentUI/Controls/FluPasswordBox.qml b/src/imports/FluentUI/Controls/FluPasswordBox.qml index 54f61f8d..8dfc0d3e 100644 --- a/src/imports/FluentUI/Controls/FluPasswordBox.qml +++ b/src/imports/FluentUI/Controls/FluPasswordBox.qml @@ -24,7 +24,8 @@ TextField{ font:FluTextStyle.Body echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering - selectionColor: FluTheme.primaryColor.lightest + selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) + selectedTextColor: color placeholderTextColor: { if(!enabled){ return placeholderDisableColor diff --git a/src/imports/FluentUI/Controls/FluTableView.qml b/src/imports/FluentUI/Controls/FluTableView.qml index 6fe8022d..1b81d33c 100644 --- a/src/imports/FluentUI/Controls/FluTableView.qml +++ b/src/imports/FluentUI/Controls/FluTableView.qml @@ -8,6 +8,7 @@ import FluentUI Rectangle { property var columnSource property var dataSource + property color selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) id:control color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) onColumnSourceChanged: { @@ -185,17 +186,28 @@ Rectangle { id:item_table property var position: Qt.point(column,row) required property bool selected - color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)) + color: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)) implicitHeight: 40 implicitWidth: columnSource[column].width + Rectangle{ + anchors.fill: parent + visible: item_loader.sourceComponent === null + color: selected ? control.selectionColor : "#00000000" + } MouseArea{ anchors.fill: parent acceptedButtons: Qt.LeftButton - onDoubleClicked: { + onPressed:{ + closeEditor() + table_view.interactive = false + } + onReleased: { + table_view.interactive = true + } + onDoubleClicked:{ if(display instanceof Component){ return } - selection_model.clear() item_loader.sourceComponent = d.obtEditDelegate(column,row) } onClicked: @@ -205,6 +217,7 @@ Rectangle { selection_model.clear() } selection_model.select(table_model.index(row,column),ItemSelectionModel.Select) + event.accepted = true } } Loader{ @@ -231,6 +244,7 @@ Rectangle { property int column property int row property var tableView: control + sourceComponent: null onDisplayChanged: { var obj = table_model.getRow(row) obj[columnSource[column].dataIndex] = display @@ -252,6 +266,11 @@ Rectangle { } bottomRightHandle:com_handle topLeftHandle: com_handle + onDraggingChanged: { + if(dragging === false){ + table_view.interactive = true + } + } } TableView { id: header_horizontal @@ -272,7 +291,7 @@ Rectangle { readonly property var obj : columnSource[column] implicitWidth: column_text.implicitWidth + (cellPadding * 2) implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2)) - color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) + color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) border.color: FluTheme.dark ? "#252525" : "#e4e4e4" FluText { id: column_text @@ -354,6 +373,7 @@ Rectangle { id:row_text anchors.centerIn: parent text: row + 1 + font.bold: true } TapHandler{ onDoubleTapped: { diff --git a/src/imports/FluentUI/Controls/FluTextBox.qml b/src/imports/FluentUI/Controls/FluTextBox.qml index 54fb863e..3a91bb24 100644 --- a/src/imports/FluentUI/Controls/FluTextBox.qml +++ b/src/imports/FluentUI/Controls/FluTextBox.qml @@ -23,7 +23,8 @@ TextField{ } font:FluTextStyle.Body renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering - selectionColor: FluTheme.primaryColor.lightest + selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) + selectedTextColor: color placeholderTextColor: { if(!enabled){ return placeholderDisableColor