This commit is contained in:
朱子楚\zhuzi 2023-07-23 21:06:46 +08:00
parent 169ca17a6a
commit 56188cfa51
3 changed files with 23 additions and 54 deletions

View File

@ -17,27 +17,22 @@ FluScrollablePage{
Layout.topMargin: 20 Layout.topMargin: 20
FluTextBox{ FluTextBox{
Layout.topMargin: 20
placeholderText: "单行输入框" placeholderText: "单行输入框"
Layout.preferredWidth: 300
disabled:text_box_switch.checked disabled:text_box_switch.checked
cleanEnabled: true
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
} }
} }
Row{ FluToggleSwitch{
spacing: 5 id:text_box_switch
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
} }
FluToggleSwitch{ text:"Disabled"
id:text_box_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
} }
} }
CodeExpander{ CodeExpander{
@ -55,27 +50,20 @@ FluScrollablePage{
Layout.topMargin: 20 Layout.topMargin: 20
FluPasswordBox{ FluPasswordBox{
Layout.topMargin: 20
placeholderText: "请输入密码" placeholderText: "请输入密码"
Layout.preferredWidth: 300
disabled:password_box_switch.checked disabled:password_box_switch.checked
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
} }
} }
FluToggleSwitch{
Row{ id:password_box_switch
spacing: 5
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
} }
FluToggleSwitch{ text:"Disabled"
id:password_box_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
} }
} }
CodeExpander{ CodeExpander{
@ -95,9 +83,7 @@ FluScrollablePage{
FluMultilineTextBox{ FluMultilineTextBox{
id:multiine_textbox id:multiine_textbox
Layout.topMargin: 20
placeholderText: "多行输入框" placeholderText: "多行输入框"
Layout.preferredWidth: 300
disabled:text_box_multi_switch.checked disabled:text_box_multi_switch.checked
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -105,17 +91,13 @@ FluScrollablePage{
} }
} }
Row{ FluToggleSwitch{
spacing: 5 id:text_box_multi_switch
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
} }
FluToggleSwitch{ text:"Disabled"
id:text_box_multi_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
} }
} }
CodeExpander{ CodeExpander{
@ -126,17 +108,13 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 height: 68
paddings: 10 paddings: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluAutoSuggestBox{ FluAutoSuggestBox{
Layout.topMargin: 20
placeholderText: "AutoSuggestBox" placeholderText: "AutoSuggestBox"
Layout.preferredWidth: 300
items:generateRandomNames(100) items:generateRandomNames(100)
disabled:text_box_suggest_switch.checked disabled:text_box_suggest_switch.checked
anchors{ anchors{
@ -144,18 +122,13 @@ FluScrollablePage{
left: parent.left left: parent.left
} }
} }
FluToggleSwitch{
Row{ id:text_box_suggest_switch
spacing: 5
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
} }
FluToggleSwitch{ text:"Disabled"
id:text_box_suggest_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
} }
} }
CodeExpander{ CodeExpander{
@ -171,34 +144,26 @@ FluScrollablePage{
height: 68 height: 68
paddings: 10 paddings: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluSpinBox{ FluSpinBox{
Layout.topMargin: 20
disabled: spin_box_switch.checked disabled: spin_box_switch.checked
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
} }
} }
FluToggleSwitch{
Row{ id:spin_box_switch
spacing: 5
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
} }
FluToggleSwitch{ text:"Disabled"
id:spin_box_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
} }
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -1
code:'FluSpinBox{ code:'FluSpinBox{
}' }'
} }

View File

@ -27,7 +27,7 @@ Rectangle{
id:com_edit id:com_edit
FluTextBox{ FluTextBox{
rightPadding: 80 rightPadding: 80
closeRightMargin: 55 iconRightMargin: 55
disabled: control.disabled disabled: control.disabled
validator: control.validator validator: control.validator
text: d._displayText text: d._displayText

View File

@ -12,7 +12,8 @@ TextField{
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1) property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1) property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
property int closeRightMargin: icon_end.visible ? 25 : 5 property int iconRightMargin: icon_end.visible ? 25 : 5
property bool cleanEnabled: false
id:control id:control
width: 300 width: 300
padding: 8 padding: 8
@ -74,6 +75,9 @@ TextField{
width: 20 width: 20
height: 20 height: 20
visible: { visible: {
if(control.cleanEnabled === false){
return false
}
if(control.readOnly) if(control.readOnly)
return false return false
return control.text !== "" return control.text !== ""
@ -81,7 +85,7 @@ TextField{
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
rightMargin: closeRightMargin rightMargin: control.iconRightMargin
} }
contentDescription:"清空" contentDescription:"清空"
onClicked:{ onClicked:{