This commit is contained in:
zhuzichu 2023-07-03 11:50:26 +08:00
parent d1656cfb63
commit 0d4dd483da
10 changed files with 160 additions and 71 deletions

View File

@ -12,32 +12,71 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 260 height: 110
paddings: 10 paddings: 10
ColumnLayout{ ColumnLayout{
spacing: 20 spacing: 10
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
} }
FluText{
text: "indeterminate = true"
}
FluProgressBar{ FluProgressBar{
} }
FluProgressRing{ FluProgressRing{
} }
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluProgressBar{
}
FluProgressRing{
}
'
}
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 230
paddings: 10
ColumnLayout{
spacing: 10
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: "indeterminate = false"
}
FluProgressBar{ FluProgressBar{
id:progress_bar
indeterminate: false indeterminate: false
progress: slider.value/100
} }
FluProgressRing{ FluProgressRing{
id:progress_ring
indeterminate: false indeterminate: false
progress: slider.value/100
}
FluProgressBar{
indeterminate: false
progressVisible: true
progress: slider.value/100
}
FluProgressRing{
indeterminate: false
progressVisible: true
progress: slider.value/100
} }
FluSlider{ FluSlider{
onValueChanged:{ id:slider
var progress = value/100
progress_bar.progress = progress
progress_ring.progress = progress
}
Component.onCompleted: { Component.onCompleted: {
value = 50 value = 50
} }
@ -48,22 +87,14 @@ FluScrollablePage{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -1
code:'FluProgressBar{ code:'FluProgressBar{
}
FluProgressRing{
}
FluProgressBar{
indeterminate: false indeterminate: false
} }
FluProgressRing{ FluProgressRing{
indeterminate: false indeterminate: false
}' progressVisible: true
}
'
} }
} }

View File

@ -12,7 +12,7 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 480 height: 460
paddings: 10 paddings: 10
Column{ Column{

View File

@ -64,8 +64,8 @@ FluContentPage{
address: getRandomAddresses(), address: getRandomAddresses(),
nickname: getRandomNickname(), nickname: getRandomNickname(),
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好", longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
height:46, height:42,
minimumHeight:46, minimumHeight:42,
maximumHeight:300, maximumHeight:300,
action:com_action action:com_action
}) })

View File

@ -39,8 +39,8 @@ ComboBox {
} }
contentItem: T.TextField { contentItem: T.TextField {
property bool disabled: !control.editable property bool disabled: !control.editable
leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1 rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
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

View File

@ -23,7 +23,7 @@ TextArea{
font:FluTextStyle.Body font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
padding: 8 padding: 8
leftPadding: 8 leftPadding: padding+2
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectedTextColor: color selectedTextColor: color
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)

View File

@ -23,7 +23,7 @@ TextField{
} }
font:FluTextStyle.Body font:FluTextStyle.Body
padding: 8 padding: 8
leftPadding: 8 leftPadding: padding+2
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: Qt.alpha(FluTheme.primaryColor.lightest,0.6) selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)

View File

@ -2,44 +2,67 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI import FluentUI
FluRectangle { Item{
property real progress: 0.5 property real progress: 0.5
property bool indeterminate: true property bool indeterminate: true
property bool progressVisible: false
id: control id: control
width: 150 width: 150
height: 5 height: 5
radius: [3,3,3,3]
clip: true FluRectangle {
color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1) shadow: false
Component.onCompleted: { radius: [3,3,3,3]
if(indeterminate){ anchors.fill: parent
bar.x = -control.width*0.5 color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
behavior.enabled = true Component.onCompleted: {
bar.x = control.width if(indeterminate){
}else{ bar.x = -control.width*0.5
bar.x = 0 behavior.enabled = true
bar.x = control.width
}else{
bar.x = 0
}
} }
} Rectangle{
Rectangle{ id:bar
id:bar radius: 3
radius: 3 width: control.width*progress
width: control.width*progress height: control.height
height: control.height color:FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
color:FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark Behavior on x{
Behavior on x{ id:behavior
id:behavior enabled: false
enabled: false NumberAnimation{
NumberAnimation{ duration: 1000
duration: 1000 onRunningChanged: {
onRunningChanged: { if(!running){
if(!running){ behavior.enabled = false
behavior.enabled = false bar.x = -control.width*0.5
bar.x = -control.width*0.5 behavior.enabled = true
behavior.enabled = true bar.x = control.width
bar.x = control.width }
} }
} }
} }
} }
} }
FluText{
text:(control.progress * 100).toFixed(0) + "%"
font.pixelSize: 10
visible: {
if(control.indeterminate){
return false
}
return control.progressVisible
}
anchors{
left: parent.left
leftMargin: control.width+5
verticalCenter: parent.verticalCenter
}
}
} }

View File

@ -6,8 +6,8 @@ Rectangle {
property real linWidth : width/8 property real linWidth : width/8
property real progress: 0.25 property real progress: 0.25
property bool indeterminate: true property bool indeterminate: true
readonly property real radius2 : radius - linWidth/2
property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property bool progressVisible: false
id: control id: control
width: 44 width: 44
height: 44 height: 44
@ -24,6 +24,10 @@ Rectangle {
control.rotation = 360 control.rotation = 360
} }
} }
QtObject{
id:d
property real _radius: control.radius-control.linWidth/2
}
Connections{ Connections{
target: FluTheme target: FluTheme
function onDarkChanged(){ function onDarkChanged(){
@ -53,18 +57,29 @@ Rectangle {
antialiasing: true antialiasing: true
renderTarget: Canvas.Image renderTarget: Canvas.Image
onPaint: { onPaint: {
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d")
ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.setTransform(1, 0, 0, 1, 0, 0)
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.save(); ctx.save()
ctx.lineWidth = linWidth; ctx.lineWidth = linWidth
ctx.strokeStyle = primaryColor; ctx.strokeStyle = primaryColor
ctx.fillStyle = primaryColor; ctx.fillStyle = primaryColor
ctx.beginPath(); ctx.beginPath()
ctx.arc(width/2, height/2, radius2 ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI); ctx.arc(width/2, height/2, d._radius ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI)
ctx.stroke(); ctx.stroke()
ctx.closePath(); ctx.closePath()
ctx.restore(); ctx.restore()
} }
} }
FluText{
text:(control.progress * 100).toFixed(0) + "%"
font.pixelSize: 10
visible: {
if(control.indeterminate){
return false
}
return control.progressVisible
}
anchors.centerIn: parent
}
} }

View File

@ -49,6 +49,9 @@ Rectangle {
if(obj){ if(obj){
return obj return obj
} }
if(columnSource[column].editMultiline === true){
return com_edit_multiline
}
return com_edit return com_edit
} }
} }
@ -63,6 +66,23 @@ Rectangle {
} }
Component{ Component{
id:com_edit id:com_edit
FluTextBox{
text: display
readOnly: true === columnSource[column].readOnly
Component.onCompleted: {
forceActiveFocus()
selectAll()
}
onCommit: {
if(!readOnly){
display = text
}
tableView.closeEditor()
}
}
}
Component{
id:com_edit_multiline
Item{ Item{
anchors.fill: parent anchors.fill: parent
ScrollView{ ScrollView{
@ -455,7 +475,7 @@ Rectangle {
var minimumHeight = obj.minimumHeight var minimumHeight = obj.minimumHeight
var maximumHeight = obj.maximumHeight var maximumHeight = obj.maximumHeight
if(!minimumHeight){ if(!minimumHeight){
minimumHeight = 46 minimumHeight = 42
} }
if(!maximumHeight){ if(!maximumHeight){
maximumHeight = 65535 maximumHeight = 65535

View File

@ -16,7 +16,7 @@ TextField{
id:control id:control
width: 300 width: 300
padding: 8 padding: 8
leftPadding: 8 leftPadding: padding+2
enabled: !disabled enabled: !disabled
color: { color: {
if(!enabled){ if(!enabled){