This commit is contained in:
朱子楚\zhuzi 2023-06-29 22:30:15 +08:00
parent bfa5c93d40
commit 294606d019
7 changed files with 35 additions and 12 deletions

View File

@ -63,7 +63,7 @@ FluContentPage{
age:getRandomAge(), age:getRandomAge(),
address: getRandomAddresses(), address: getRandomAddresses(),
nickname: getRandomNickname(), nickname: getRandomNickname(),
longstring:"测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试", longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
height:46, height:46,
minimumHeight:46, minimumHeight:46,
maximumHeight:300, maximumHeight:300,

View File

@ -44,8 +44,8 @@ ComboBox {
topPadding: 6 - control.padding topPadding: 6 - control.padding
bottomPadding: 6 - control.padding bottomPadding: 6 - control.padding
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTheme.primaryColor.lightest selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
selectedTextColor: control.palette.highlightedText selectedTextColor: color
text: control.editable ? control.editText : control.displayText text: control.editable ? control.editText : control.displayText
enabled: control.editable enabled: control.editable
autoScroll: control.editable autoScroll: control.editable

View File

@ -15,9 +15,9 @@ TextEdit {
rightPadding: 0 rightPadding: 0
topPadding: 0 topPadding: 0
selectByMouse: true selectByMouse: true
selectedTextColor: FluColors.Grey220 selectedTextColor: color
bottomPadding: 0 bottomPadding: 0
selectionColor: FluTheme.primaryColor.lightest selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
font:FluTextStyle.Body font:FluTextStyle.Body
onSelectedTextChanged: { onSelectedTextChanged: {
control.forceActiveFocus() control.forceActiveFocus()

View File

@ -23,7 +23,8 @@ TextArea{
font:FluTextStyle.Body font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTheme.primaryColor.lightest selectedTextColor: color
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){
return placeholderDisableColor return placeholderDisableColor

View File

@ -24,7 +24,8 @@ TextField{
font:FluTextStyle.Body font:FluTextStyle.Body
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTheme.primaryColor.lightest selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
selectedTextColor: color
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){
return placeholderDisableColor return placeholderDisableColor

View File

@ -8,6 +8,7 @@ import FluentUI
Rectangle { Rectangle {
property var columnSource property var columnSource
property var dataSource property var dataSource
property color selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
id:control id:control
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
onColumnSourceChanged: { onColumnSourceChanged: {
@ -185,17 +186,28 @@ Rectangle {
id:item_table id:item_table
property var position: Qt.point(column,row) property var position: Qt.point(column,row)
required property bool selected 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 implicitHeight: 40
implicitWidth: columnSource[column].width implicitWidth: columnSource[column].width
Rectangle{
anchors.fill: parent
visible: item_loader.sourceComponent === null
color: selected ? control.selectionColor : "#00000000"
}
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onDoubleClicked: { onPressed:{
closeEditor()
table_view.interactive = false
}
onReleased: {
table_view.interactive = true
}
onDoubleClicked:{
if(display instanceof Component){ if(display instanceof Component){
return return
} }
selection_model.clear()
item_loader.sourceComponent = d.obtEditDelegate(column,row) item_loader.sourceComponent = d.obtEditDelegate(column,row)
} }
onClicked: onClicked:
@ -205,6 +217,7 @@ Rectangle {
selection_model.clear() selection_model.clear()
} }
selection_model.select(table_model.index(row,column),ItemSelectionModel.Select) selection_model.select(table_model.index(row,column),ItemSelectionModel.Select)
event.accepted = true
} }
} }
Loader{ Loader{
@ -231,6 +244,7 @@ Rectangle {
property int column property int column
property int row property int row
property var tableView: control property var tableView: control
sourceComponent: null
onDisplayChanged: { onDisplayChanged: {
var obj = table_model.getRow(row) var obj = table_model.getRow(row)
obj[columnSource[column].dataIndex] = display obj[columnSource[column].dataIndex] = display
@ -252,6 +266,11 @@ Rectangle {
} }
bottomRightHandle:com_handle bottomRightHandle:com_handle
topLeftHandle: com_handle topLeftHandle: com_handle
onDraggingChanged: {
if(dragging === false){
table_view.interactive = true
}
}
} }
TableView { TableView {
id: header_horizontal id: header_horizontal
@ -272,7 +291,7 @@ Rectangle {
readonly property var obj : columnSource[column] readonly property var obj : columnSource[column]
implicitWidth: column_text.implicitWidth + (cellPadding * 2) implicitWidth: column_text.implicitWidth + (cellPadding * 2)
implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (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" border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
FluText { FluText {
id: column_text id: column_text
@ -354,6 +373,7 @@ Rectangle {
id:row_text id:row_text
anchors.centerIn: parent anchors.centerIn: parent
text: row + 1 text: row + 1
font.bold: true
} }
TapHandler{ TapHandler{
onDoubleTapped: { onDoubleTapped: {

View File

@ -23,7 +23,8 @@ TextField{
} }
font:FluTextStyle.Body font:FluTextStyle.Body
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTheme.primaryColor.lightest selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
selectedTextColor: color
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){
return placeholderDisableColor return placeholderDisableColor