From de22db805a5dc59b373110c7e298c20d4b3bc661 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 13 Jan 2012 20:10:34 +0100 Subject: [PATCH] use the common clear icon --- .../platformcomponents/touch/TextField.qml | 19 ++++++++++--------- .../plasmacomponents/qml/TextField.qml | 9 ++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml index daa54ea56..33a5a6140 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml @@ -21,6 +21,7 @@ import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.qtextracomponents 0.1 import "EditBubble.js" as EditBubbleHelper +import "private" as Private Item { id: textField @@ -168,12 +169,13 @@ Item { Keys.onReleased: textField.Keys.released(event); } - PlasmaCore.SvgItem { + + Private.IconLoader { parent: mouseEventListener // reparent to the MouseFilter for MouseArea to work - svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"} - elementId: "clearbutton" - width: textInput.height - height: textInput.height + id: clearButton + source: "edit-clear-locationbar-rtl" + height: Math.max(textInput.height, theme.smallIconSize) + width: height opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0 Behavior on opacity { NumberAnimation { @@ -184,14 +186,13 @@ Item { anchors { right: parent.right rightMargin: y - verticalCenter: parent.verticalCenter + verticalCenter: textInput.verticalCenter } MouseArea { anchors.fill: parent onClicked: { - textInput.text = ""; - textInput.forceActiveFocus(); - editBubble.state = "collapsed" + textInput.text = "" + textInput.forceActiveFocus() } } } diff --git a/declarativeimports/plasmacomponents/qml/TextField.qml b/declarativeimports/plasmacomponents/qml/TextField.qml index fcbc8fdc6..865403398 100644 --- a/declarativeimports/plasmacomponents/qml/TextField.qml +++ b/declarativeimports/plasmacomponents/qml/TextField.qml @@ -297,12 +297,11 @@ Item { } } - PlasmaCore.SvgItem { + Private.IconLoader { id: clearButton - svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"} - elementId: "clearbutton" - width: textInput.height - height: textInput.height + source: "edit-clear-locationbar-rtl" + height: Math.max(textInput.height, theme.smallIconSize) + width: height opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0 Behavior on opacity { NumberAnimation {