19#include "moc_qgspasswordlineedit.cpp"
28 mActionShowHidePassword = addAction( mShowPasswordIcon, QLineEdit::TrailingPosition );
29 mActionShowHidePassword->setCheckable(
true );
31 if ( mLockIconVisible )
37 connect( mActionShowHidePassword, &QAction::triggered,
this, &QgsPasswordLineEdit::togglePasswordVisibility );
42 togglePasswordVisibility( visible );
45void QgsPasswordLineEdit::togglePasswordVisibility(
bool toggled )
49 setEchoMode( QLineEdit::Normal );
50 mActionShowHidePassword->setIcon( mHidePasswordIcon );
51 mActionShowHidePassword->setToolTip( tr(
"Hide text" ) );
55 setEchoMode( QLineEdit::Password );
56 mActionShowHidePassword->setIcon( mShowPasswordIcon );
57 mActionShowHidePassword->setToolTip( tr(
"Show text" ) );
63 mLockIconVisible = visible;
64 if ( mLockIconVisible )
75 removeAction( mActionLock );
76 mActionLock =
nullptr;
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
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.