QGIS API Documentation 3.41.0-Master (57ec4277f5e)
Loading...
Searching...
No Matches
qgspasswordlineedit.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspasswordlineedit.h
3 ------------------------
4 begin : March 13, 2017
5 copyright : (C) 2017 by Alexander Bruy
6 email : alexander dot bruy at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPASSWORDLINEEDIT_H
19#define QGSPASSWORDLINEEDIT_H
20
21#include <QLineEdit>
22#include <QAction>
23
24#include "qgis_gui.h"
25
32class GUI_EXPORT QgsPasswordLineEdit : public QLineEdit
33{
34 Q_OBJECT
35 Q_PROPERTY( bool showLockIcon READ showLockIcon WRITE setShowLockIcon )
36
37 public:
43 QgsPasswordLineEdit( QWidget *parent = nullptr, bool passwordVisible = false );
44
49 void setShowLockIcon( bool visible );
50
54 bool showLockIcon() const { return mLockIconVisible; }
55
59 void setPasswordVisibility( bool visible );
60
61 private slots:
62 void togglePasswordVisibility( bool toggled );
63
64 private:
65 QAction *mActionShowHidePassword = nullptr;
66 QAction *mActionLock = nullptr;
67
68 QIcon mShowPasswordIcon;
69 QIcon mHidePasswordIcon;
70
71 bool mLockIconVisible = false;
72 QSize mIconsSize;
73};
74
75#endif // QGSPASSWORDLINEEDIT_H
QLineEdit subclass with built in support for showing/hiding entered password.
bool showLockIcon() const
Returns if a lock icon shall be shown on the left of the widget.