Warning, /maui/mauikit/src/controls.6/PasswordField.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
0003 *
0004 * This program is free software; you can redistribute it and/or modify
0005 * it under the terms of the GNU Library General Public License as
0006 * published by the Free Software Foundation; either version 2, or
0007 * (at your option) any later version.
0008 *
0009 * This program is distributed in the hope that it will be useful,
0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012 * GNU General Public License for more details
0013 *
0014 * You should have received a copy of the GNU Library General Public
0015 * License along with this program; if not, write to the
0016 * Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020 import QtQuick
0021 import QtQuick.Controls
0022
0023 /**
0024 * @inherit QtQuick.Controls.TextField
0025 * @brief A text field meant to enter passwords.
0026 *
0027 * <a href="https://doc.qt.io/qt-6/qml-qtquick-controls-textfield.html">This control inherits from QQC2 TextField, to checkout its inherited properties refer to the Qt Docs.</a>
0028 *
0029 * 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.
0030 *
0031 * @note Some extra properties inherited from the TextField style, have been obscured, and can be discovered on the SearchField documentation.
0032 * @see SearchField
0033 */
0034 TextField
0035 {
0036 id: control
0037 echoMode: TextInput.Password
0038 passwordMaskDelay: 300
0039 inputMethodHints: Qt.ImhNoAutoUppercase
0040
0041 /**
0042 * @private
0043 */
0044 property int previousEchoMode
0045
0046 icon.source: "lock"
0047
0048 actions: Action
0049 {
0050 icon.name: control.echoMode === TextInput.Normal ? "view-hidden" : "view-visible"
0051 icon.color: control.color
0052 onTriggered:
0053 {
0054 if(control.echoMode === TextInput.Normal)
0055 {
0056 control.echoMode = control.previousEchoMode
0057 }else
0058 {
0059 control.echoMode = TextInput.Normal
0060 }
0061 }
0062 }
0063
0064 Component.onCompleted:
0065 {
0066 control.previousEchoMode = control.echoMode
0067 }
0068 }