1 files changed, 34 insertions, 0 deletions
diff --git a/resources/qml/MatrixTextField.qml b/resources/qml/MatrixTextField.qml
index 3f0f77ed..e3632b61 100644
--- a/resources/qml/MatrixTextField.qml
+++ b/resources/qml/MatrixTextField.qml
@@ -20,6 +20,7 @@ ColumnLayout {
property alias font: input.font
property alias echoMode: input.echoMode
property alias selectByMouse: input.selectByMouse
+ property var hasClear: false
Timer {
id: timer
@@ -129,6 +130,39 @@ ColumnLayout {
color: labelC.text ? "transparent" : backgroundColor
}
+ ToolButton {
+ id: clearText
+ Layout.fillWidth: true
+ visible: c.hasClear && searchField.text !== ''
+ icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearText.hovered ? Nheko.colors.highlight : Nheko.colors.buttonText)
+ focusPolicy: Qt.NoFocus
+ onClicked: {
+ searchField.clear()
+ topBar.searchString = "";
+ }
+ hoverEnabled: true
+ background: null
+ anchors {
+ verticalCenter: parent.verticalCenter
+ right: parent.right
+ }
+ // clear the default hover effects.
+
+ Image {
+ height: parent.height - 2 * Nheko.paddingSmall
+ width: height
+ source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearText.hovered ? Nheko.colors.highlight : Nheko.colors.buttonText)
+
+ anchors {
+ verticalCenter: parent.verticalCenter
+ right: parent.right
+ margins: Nheko.paddingSmall
+ }
+
+ }
+
+ }
+
}
Rectangle {
|