QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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:
38
44 QgsPasswordLineEdit( QWidget *parent = nullptr, bool passwordVisible = false );
45
50 void setShowLockIcon( bool visible );
51
55 bool showLockIcon() const { return mLockIconVisible; }
56
60 void setPasswordVisibility( bool visible );
61
62 private slots:
63 void togglePasswordVisibility( bool toggled );
64
65 private:
66
67 QAction *mActionShowHidePassword = nullptr;
68 QAction *mActionLock = nullptr;
69
70 QIcon mShowPasswordIcon;
71 QIcon mHidePasswordIcon;
72
73 bool mLockIconVisible = false;
74 QSize mIconsSize;
75};
76
77#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.