1
0
Fork 0

Launcher search box clear icon

This commit is contained in:
James Turner 2018-07-05 00:36:46 +01:00
parent 916f2d7d76
commit 0f83a71860
3 changed files with 7 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

View file

@ -30,6 +30,8 @@ FocusScope
root.search(""); root.search("");
} }
readonly property bool canClear: (buttonText.text.length > 0)
Rectangle Rectangle
{ {
id: frame id: frame
@ -41,8 +43,6 @@ FocusScope
border.color: (mouse.containsMouse | active) ? Style.themeColor: Style.minorFrameColor border.color: (mouse.containsMouse | active) ? Style.themeColor: Style.minorFrameColor
clip: true clip: true
TextInput { TextInput {
id: buttonText id: buttonText
anchors.left: parent.left anchors.left: parent.left
@ -86,7 +86,7 @@ FocusScope
Image { Image {
id: searchIcon id: searchIcon
source: clearButtonMouse.containsMouse ? "qrc:///up-down-arrow" :"qrc:///search-icon-small" source: root.canClear ? "qrc:///clear-text-icon" :"qrc:///search-icon-small"
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.margin anchors.rightMargin: Style.margin
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -113,11 +113,9 @@ FocusScope
anchors.right: parent.right anchors.right: parent.right
height: parent.height height: parent.height
width: searchIcon.width width: searchIcon.width
hoverEnabled: true hoverEnabled: root.canClear
visible: root.canClear
onClicked: { onClicked: clear();
clear();
}
} }
Timer { Timer {

View file

@ -108,6 +108,7 @@
<file>qml/ToggleBox.qml</file> <file>qml/ToggleBox.qml</file>
<file>qml/LocationAltitudeRow.qml</file> <file>qml/LocationAltitudeRow.qml</file>
<file>qml/CatalogDelegate.qml</file> <file>qml/CatalogDelegate.qml</file>
<file alias="clear-text-icon">assets/icons8-clear-symbol-26.png</file>
</qresource> </qresource>
<qresource prefix="/preview"> <qresource prefix="/preview">
<file alias="close-icon">preview-close.png</file> <file alias="close-icon">preview-close.png</file>