Kirigami2

PasswordField.qml
1/*
2 * SPDX-FileCopyrightText: 2019 Carl-Lucien Schwan <carl@carlschwan.eu>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import org.kde.kirigami as Kirigami
9
10/**
11 * @brief This is a standard password text field.
12 *
13 * Example usage:
14 * @code{.qml}
15 * import org.kde.kirigami as Kirigami
16 *
17 * Kirigami.PasswordField {
18 * id: passwordField
19 * onAccepted: {
20 * // check if passwordField.text is valid
21 * }
22 * }
23 * @endcode
24 *
25 * @inherit org::kde::kirgami::ActionTextField
26 * @since 5.57
27 * @author Carl Schwan <carl@carlschwan.eu>
28 */
29Kirigami.ActionTextField {
30 id: root
31
32 /**
33 * @brief This property tells whether the password will be displayed in cleartext rather than obfuscated.
34 *
35 * default: ``false``
36 *
37 * @since 5.57
38 */
39 property bool showPassword: false
40
41 echoMode: root.showPassword ? TextInput.Normal : TextInput.Password
42 placeholderText: qsTr("Password")
44 rightActions: Kirigami.Action {
45 text: root.showPassword ? qsTr("Hide Password") : qsTr("Show Password")
46 icon.name: root.showPassword ? "password-show-off" : "password-show-on"
47 onTriggered: root.showPassword = !root.showPassword
48 }
49
50 Keys.onPressed: event => {
51 if (event.matches(StandardKey.Undo)) {
52 // Disable undo action for security reasons
53 // See QTBUG-103934
54 event.accepted = true
55 }
56 }
57}
An item that represents an abstract Action.
Definition Action.qml:17
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
QString name(GameStandardAction id)
ImhNoAutoUppercase
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:05:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.