Changeset View
Changeset View
Standalone View
Standalone View
tests/LineEditWithClearButton.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2019 Montel Laurent <montel@kde.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or modify | ||||
5 | it under the terms of the GNU Library General Public License as published | ||||
6 | by the Free Software Foundation; either version 2 of the License or | ||||
7 | ( at your option ) version 3 or, at the discretion of KDE e.V. | ||||
8 | ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. | ||||
9 | | ||||
10 | This library is distributed in the hope that it will be useful, | ||||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | Library General Public License for more details. | ||||
14 | | ||||
15 | You should have received a copy of the GNU Library General Public License | ||||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
18 | Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | import org.kde.kirigami 2.7 as Kirigami | ||||
22 | Kirigami.ActionTextField { | ||||
23 | id: __searchField | ||||
24 | focus: true | ||||
25 | rightActions: [ | ||||
26 | Kirigami.Action { | ||||
27 | iconName: "edit-clear" | ||||
28 | visible: __searchField.text !== "" | ||||
29 | onTriggered: { | ||||
30 | __searchField.text = "" | ||||
31 | __searchField.accepted() | ||||
32 | } | ||||
33 | } | ||||
34 | ] | ||||
35 | } |