diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-07-31 18:58:39 +0200 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-07-31 18:58:39 +0200 |
commit | ed90f285745279e91743851ae49eeccf1d95710f (patch) | |
tree | c901f650c3b2b22e9cf0ce1af811452c5707e7ee /framework/qml/PasswordField.qml | |
parent | 32e9eda3bd93e3197234cd9947a5522e5eb9da94 (diff) | |
download | kube-ed90f285745279e91743851ae49eeccf1d95710f.tar.gz kube-ed90f285745279e91743851ae49eeccf1d95710f.zip |
dedicated Kube.PasswordField
Diffstat (limited to 'framework/qml/PasswordField.qml')
-rw-r--r-- | framework/qml/PasswordField.qml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/framework/qml/PasswordField.qml b/framework/qml/PasswordField.qml new file mode 100644 index 00000000..786b3d46 --- /dev/null +++ b/framework/qml/PasswordField.qml | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.7 | ||
20 | import org.kube.framework 1.0 as Kube | ||
21 | |||
22 | Kube.TextField { | ||
23 | id: root | ||
24 | |||
25 | property bool showPassword | ||
26 | |||
27 | echoMode: showPassword ? TextInput.Normal : TextInput.Password | ||
28 | |||
29 | Kube.IconButton { | ||
30 | anchors { | ||
31 | right: parent.right | ||
32 | verticalCenter: parent.verticalCenter | ||
33 | } | ||
34 | |||
35 | onClicked: { | ||
36 | root.showPassword = !root.showPassword | ||
37 | } | ||
38 | |||
39 | iconName: root.showPassword ? Kube.Icons.password_hide : Kube.Icons.password_show | ||
40 | } | ||
41 | } | ||