This commit is contained in:
朱子楚\zhuzi 2023-06-30 22:50:44 +08:00
parent 64bbae9266
commit 21ddc79f3f
8 changed files with 133 additions and 23 deletions

View File

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

View File

@ -174,7 +174,7 @@ FluScrollablePage{
FluSpinBox{
Layout.topMargin: 20
disabled: spin_box_switch.checked
// disabled: spin_box_switch.checked
anchors{
verticalCenter: parent.verticalCenter
left: parent.left

View File

@ -76,7 +76,7 @@ ComboBox {
background: Rectangle {
implicitWidth: 140
implicitHeight: 28
implicitHeight: 32
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
border.width: 1
visible: !control.flat || control.down

View File

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

View File

@ -22,6 +22,8 @@ TextField{
return normalColor
}
font:FluTextStyle.Body
padding: 8
leftPadding: 8
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)

View File

@ -3,40 +3,145 @@ import QtQuick.Layouts
import QtQuick.Controls
import FluentUI
FluTextBox {
Rectangle{
readonly property string displayText : d._displayText
property int from: 0
property int to: 99
property var validator: IntValidator {
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
}
id:control
width: 200
closeRightMargin:55
rightPadding: 80
text:"0"
validator: IntValidator {}
inputMethodHints: Qt.ImhDigitsOnly
implicitWidth: 200
implicitHeight: 34
radius: 4
color: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
border.width: 1
border.color: FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
QtObject{
id:d
property string _displayText: "0"
}
Component{
id:com_edit
FluTextBox{
rightPadding: 80
closeRightMargin: 55
validator: control.validator
text: d._displayText
Component.onCompleted: {
forceActiveFocus()
}
onCommit: {
var number = Number(text)
if(number>=control.from && number<=control.to){
d._displayText = String(number)
}
edit_loader.sourceComponent = null
}
onActiveFocusChanged: {
if(!activeFocus){
edit_loader.sourceComponent = null
}
}
}
}
FluTextBox{
id:text_number
anchors.fill: parent
readOnly: true
rightPadding: 80
text: control.displayText
MouseArea{
anchors.fill: parent
onClicked: {
edit_loader.sourceComponent = com_edit
}
}
}
Loader{
id:edit_loader
anchors.fill: parent
}
FluIconButton{
id:btn_up
width: 20
height: 20
iconSize: 16
iconSource: FluentIcons.ChevronUp
enabled: Number(control.displayText) !== control.to
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 30
}
onClicked: {
control.text = Number(control.text) + 1
d._displayText = String(Math.min(Number(d._displayText)+1,control.to))
}
MouseArea{
anchors.fill: parent
onReleased: {
timer.stop()
}
TapHandler{
onTapped: {
btn_up.clicked()
}
onCanceled: {
timer.stop()
}
onLongPressed: {
timer.isUp = true
timer.start()
}
}
}
}
FluIconButton{
id:btn_down
iconSource: FluentIcons.ChevronDown
width: 20
height: 20
iconSize: 16
enabled: Number(control.displayText) !== control.from
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
onClicked: {
control.text = Number(control.text) - 1
d._displayText = String(Math.max(Number(d._displayText)-1,control.from))
}
MouseArea{
anchors.fill: parent
onReleased: {
timer.stop()
}
TapHandler{
onTapped: {
btn_down.clicked()
}
onCanceled: {
timer.stop()
}
onLongPressed: {
timer.isUp = false
timer.start()
}
}
}
}
Timer{
id:timer
property bool isUp : true
interval: 50
repeat: true
onTriggered: {
if(isUp){
btn_up.clicked()
}else{
btn_down.clicked()
}
}
}
}

View File

@ -154,6 +154,11 @@ Rectangle {
selectionModel: ItemSelectionModel {
id:selection_model
model: table_model
onSelectionChanged: {
if(selection_rect.dragging){
d.selectionFlag = !d.selectionFlag
}
}
}
columnWidthProvider: function(column) {
var w = columnSource[column].width
@ -194,7 +199,7 @@ Rectangle {
implicitWidth: columnSource[column].width
Rectangle{
anchors.fill: parent
visible: item_loader.sourceComponent == null
visible: item_loader.sourceComponent === null
color: selected ? control.selectionColor : "#00000000"
}
MouseArea{
@ -258,16 +263,10 @@ Rectangle {
}
Component{
id:com_handle
Item {
onYChanged: {
d.selectionFlag = !d.selectionFlag
}
onXChanged: {
d.selectionFlag = !d.selectionFlag
}
}
Item {}
}
SelectionRectangle {
id:selection_rect
target: {
if(item_loader.sourceComponent){
return null
@ -453,7 +452,7 @@ Rectangle {
var minimumHeight = obj.minimumHeight
var maximumHeight = obj.maximumHeight
if(!minimumHeight){
minimumHeight = 46
minimumHeight = 44
}
if(!maximumHeight){
maximumHeight = 65535

View File

@ -15,6 +15,8 @@ TextField{
property int closeRightMargin: icon_end.visible ? 25 : 5
id:control
width: 300
padding: 8
leftPadding: 8
enabled: !disabled
color: {
if(!enabled){