27 mActionShowHidePassword = addAction( mShowPasswordIcon, QLineEdit::TrailingPosition );
28 mActionShowHidePassword->setCheckable(
true );
30 if ( mLockIconVisible )
36 connect( mActionShowHidePassword, &QAction::triggered,
this, &QgsPasswordLineEdit::togglePasswordVisibility );
41 togglePasswordVisibility( visible );
44 void QgsPasswordLineEdit::togglePasswordVisibility(
bool toggled )
48 setEchoMode( QLineEdit::Normal );
49 mActionShowHidePassword->setIcon( mHidePasswordIcon );
50 mActionShowHidePassword->setToolTip( tr(
"Hide text" ) );
54 setEchoMode( QLineEdit::Password );
55 mActionShowHidePassword->setIcon( mShowPasswordIcon );
56 mActionShowHidePassword->setToolTip( tr(
"Show text" ) );
62 mLockIconVisible = visible;
63 if ( mLockIconVisible )
74 removeAction( mActionLock );
75 mActionLock =
nullptr;
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
void setPasswordVisibility(bool visible)
Set state of the password's visibility.
QgsPasswordLineEdit(QWidget *parent=nullptr, bool passwordVisible=false)
Constructor for QgsPasswordLineEdit.
void setShowLockIcon(bool visible)
Define if a lock icon shall be shown on the left of the widget.