Warning, /frameworks/kirigami/src/controls/PasswordField.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Carl-Lucien Schwan <carl@carlschwan.eu> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import org.kde.kirigami as Kirigami 0009 0010 /** 0011 * @brief This is a standard password text field. 0012 * 0013 * Example usage: 0014 * @code{.qml} 0015 * import org.kde.kirigami 2.20 as Kirigami 0016 * 0017 * Kirigami.PasswordField { 0018 * id: passwordField 0019 * onAccepted: { 0020 * // check if passwordField.text is valid 0021 * } 0022 * } 0023 * @endcode 0024 * 0025 * @inherit org::kde::kirgami::ActionTextField 0026 * @since 5.57 0027 * @author Carl Schwan <carl@carlschwan.eu> 0028 */ 0029 Kirigami.ActionTextField { 0030 id: root 0031 0032 /** 0033 * @brief This property tells whether the password will be displayed in cleartext rather than obfuscated. 0034 * 0035 * default: ``false`` 0036 * 0037 * @since 5.57 0038 */ 0039 property bool showPassword: false 0040 0041 echoMode: root.showPassword ? TextInput.Normal : TextInput.Password 0042 placeholderText: qsTr("Password") 0043 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhSensitiveData 0044 rightActions: Kirigami.Action { 0045 text: root.showPassword ? qsTr("Hide Password") : qsTr("Show Password") 0046 icon.name: root.showPassword ? "password-show-off" : "password-show-on" 0047 onTriggered: root.showPassword = !root.showPassword 0048 } 0049 0050 Keys.onPressed: event => { 0051 if (event.matches(StandardKey.Undo)) { 0052 // Disable undo action for security reasons 0053 // See QTBUG-103934 0054 event.accepted = true 0055 } 0056 } 0057 }