MauiKit Controls

PasswordField.qml
1/*
2 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, 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 Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick
21import QtQuick.Controls
22import org.mauikit.controls as Maui
23/**
24 * @inherit org.mauikit.controls.TextField
25 * @brief A text field meant to enter passwords.
26 *
27 *
28 * This control allows to mask the password as it is typed, and also includes a button action to toggle between unmask and masking the password.
29 *
30 * @see SearchField
31 */
32Maui.TextField
33{
34 id: control
35 echoMode: TextInput.Password
36 passwordMaskDelay: 300
37 inputMethodHints: Qt.ImhNoAutoUppercase
38
39 /**
40 * @private
41 */
42 property int previousEchoMode
43
44 icon.source: "lock"
45
46 actions: Action
47 {
48 icon.name: control.echoMode === TextInput.Normal ? "view-hidden" : "view-visible"
49 icon.color: control.color
50 onTriggered:
51 {
52 if(control.echoMode === TextInput.Normal)
53 {
54 control.echoMode = control.previousEchoMode
55 }else
56 {
57 control.echoMode = TextInput.Normal
58 }
59 }
60 }
61
62 Component.onCompleted:
63 {
64 control.previousEchoMode = control.echoMode
65 }
66}
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 11:57:11 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.