Files
pallectrum/electrum/gui/qml/components/controls/PasswordField.qml

39 lines
982 B
QML
Raw Normal View History

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
2022-07-26 20:36:43 +02:00
RowLayout {
id: root
property alias text: password_tf.text
2022-08-17 11:49:57 +02:00
property alias tf: password_tf
2023-03-09 16:13:24 +01:00
property alias echoMode: password_tf.echoMode
property bool showReveal: true
2022-07-26 20:36:43 +02:00
signal accepted
TextField {
id: password_tf
echoMode: TextInput.Password
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase
2022-07-26 20:36:43 +02:00
Layout.fillWidth: true
Layout.minimumWidth: fontMetrics.advanceWidth('X') * 16
2022-07-26 20:36:43 +02:00
onAccepted: root.accepted()
}
ToolButton {
2023-03-09 16:13:24 +01:00
id: revealButton
enabled: root.showReveal
opacity: root.showReveal ? 1 : 0
2022-07-26 20:36:43 +02:00
icon.source: '../../../icons/eye1.png'
onClicked: {
password_tf.echoMode = password_tf.echoMode == TextInput.Password ? TextInput.Normal : TextInput.Password
}
}
FontMetrics {
id: fontMetrics
font: password_tf.font
}
2022-07-26 20:36:43 +02:00
}