feat: Add clear action

This commit is contained in:
ChungZH 2021-07-10 21:39:34 +08:00
parent 8acf67fcf7
commit 7f86732e82
2 changed files with 19 additions and 2 deletions

View file

@ -48,7 +48,7 @@ Window {
anchors.margins: FishUI.Units.largeSpacing
spacing: FishUI.Units.largeSpacing
TextField {
FishUI.ActionTextField {
id: _textField
Layout.fillWidth: true
Keys.onEscapePressed: control.close()
@ -63,6 +63,15 @@ Window {
Component.onCompleted: {
_textField.selectAll()
}
rightActions: [
Action {
icon.source: "image://icontheme/edit-clear"
onTriggered: {
_textField.text = ""
}
}
]
}
RowLayout {

View file

@ -80,13 +80,21 @@ Window {
source: "image://icontheme/" + main.iconName
}
TextField {
FishUI.ActionTextField {
id: _textField
text: main.fileName
focus: true
Layout.fillWidth: true
Keys.onEscapePressed: control.close()
enabled: !main.multiple && main.isWritable
rightActions: [
Action {
icon.source: "image://icontheme/edit-clear"
onTriggered: {
_textField.text = ""
}
}
]
}
}