use the common clear icon

This commit is contained in:
Marco Martin 2012-01-13 20:10:34 +01:00
parent d227fdd23b
commit de22db805a
2 changed files with 14 additions and 14 deletions

View File

@ -21,6 +21,7 @@ import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.qtextracomponents 0.1 import org.kde.qtextracomponents 0.1
import "EditBubble.js" as EditBubbleHelper import "EditBubble.js" as EditBubbleHelper
import "private" as Private
Item { Item {
id: textField id: textField
@ -168,12 +169,13 @@ Item {
Keys.onReleased: textField.Keys.released(event); Keys.onReleased: textField.Keys.released(event);
} }
PlasmaCore.SvgItem {
Private.IconLoader {
parent: mouseEventListener // reparent to the MouseFilter for MouseArea to work parent: mouseEventListener // reparent to the MouseFilter for MouseArea to work
svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"} id: clearButton
elementId: "clearbutton" source: "edit-clear-locationbar-rtl"
width: textInput.height height: Math.max(textInput.height, theme.smallIconSize)
height: textInput.height width: height
opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0 opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
@ -184,14 +186,13 @@ Item {
anchors { anchors {
right: parent.right right: parent.right
rightMargin: y rightMargin: y
verticalCenter: parent.verticalCenter verticalCenter: textInput.verticalCenter
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
textInput.text = ""; textInput.text = ""
textInput.forceActiveFocus(); textInput.forceActiveFocus()
editBubble.state = "collapsed"
} }
} }
} }

View File

@ -297,12 +297,11 @@ Item {
} }
} }
PlasmaCore.SvgItem { Private.IconLoader {
id: clearButton id: clearButton
svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"} source: "edit-clear-locationbar-rtl"
elementId: "clearbutton" height: Math.max(textInput.height, theme.smallIconSize)
width: textInput.height width: height
height: textInput.height
opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0 opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {