From 7f86732e825ebae36a936d88fce351c398a1b492 Mon Sep 17 00:00:00 2001 From: ChungZH Date: Sat, 10 Jul 2021 21:39:34 +0800 Subject: [PATCH] feat: Add clear action --- qml/Dialogs/CreateFolderDialog.qml | 11 ++++++++++- qml/Dialogs/PropertiesDialog.qml | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/qml/Dialogs/CreateFolderDialog.qml b/qml/Dialogs/CreateFolderDialog.qml index 1926fad..4cc86c3 100644 --- a/qml/Dialogs/CreateFolderDialog.qml +++ b/qml/Dialogs/CreateFolderDialog.qml @@ -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 { diff --git a/qml/Dialogs/PropertiesDialog.qml b/qml/Dialogs/PropertiesDialog.qml index 6852a22..e11a6dd 100644 --- a/qml/Dialogs/PropertiesDialog.qml +++ b/qml/Dialogs/PropertiesDialog.qml @@ -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 = "" + } + } + ] } }