feat: Add clear action
This commit is contained in:
parent
8acf67fcf7
commit
7f86732e82
2 changed files with 19 additions and 2 deletions
|
@ -48,7 +48,7 @@ Window {
|
||||||
anchors.margins: FishUI.Units.largeSpacing
|
anchors.margins: FishUI.Units.largeSpacing
|
||||||
spacing: FishUI.Units.largeSpacing
|
spacing: FishUI.Units.largeSpacing
|
||||||
|
|
||||||
TextField {
|
FishUI.ActionTextField {
|
||||||
id: _textField
|
id: _textField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Keys.onEscapePressed: control.close()
|
Keys.onEscapePressed: control.close()
|
||||||
|
@ -63,6 +63,15 @@ Window {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
_textField.selectAll()
|
_textField.selectAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rightActions: [
|
||||||
|
Action {
|
||||||
|
icon.source: "image://icontheme/edit-clear"
|
||||||
|
onTriggered: {
|
||||||
|
_textField.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
@ -80,13 +80,21 @@ Window {
|
||||||
source: "image://icontheme/" + main.iconName
|
source: "image://icontheme/" + main.iconName
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
FishUI.ActionTextField {
|
||||||
id: _textField
|
id: _textField
|
||||||
text: main.fileName
|
text: main.fileName
|
||||||
focus: true
|
focus: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Keys.onEscapePressed: control.close()
|
Keys.onEscapePressed: control.close()
|
||||||
enabled: !main.multiple && main.isWritable
|
enabled: !main.multiple && main.isWritable
|
||||||
|
rightActions: [
|
||||||
|
Action {
|
||||||
|
icon.source: "image://icontheme/edit-clear"
|
||||||
|
onTriggered: {
|
||||||
|
_textField.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue