QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
QPushButtonShowPassword Class Reference

QPushButton that toggles visibility of an associated QLineEdit. More...

#include <qpushbuttonshowpassword.h>

Inheritance diagram for QPushButtonShowPassword:
Collaboration diagram for QPushButtonShowPassword:

Signals

void clicked (const QString &text)
 Emitted on button activation with the current text of the line edit.

Public Member Functions

 QPushButtonShowPassword (QLineEdit *line, QWidget *parent=nullptr)
 Construct a show-password button linked to the given QLineEdit.

Private Slots

void buttonClicked (bool checked)
 Connected to QPushButton::clicked(bool); flips the echo mode of line and updates icon, tooltip and accessible name accordingly.

Private Attributes

QIcon iconEdit
 view-visible icon shown while the password is hidden.
QIcon iconEditPushed
 view-hidden icon shown while the password is revealed.
QLineEdit * line
 The line edit being toggled; owned by the caller, must outlive this button.

Detailed Description

QPushButton that toggles visibility of an associated QLineEdit.

The button is icon-only and bound to one QLineEdit for its lifetime. Each click flips that line edit between QLineEdit::Password and QLineEdit::Normal echo mode and swaps the icon, tooltip and accessible name between "Show password" and "Hide password" to match. It is driven entirely by its own QPushButton::clicked signal; the owner only has to create it next to the line edit (PasswordDisplayPanel does this for the masked password row of a decrypted entry).

Definition at line 28 of file qpushbuttonshowpassword.h.

Constructor & Destructor Documentation

◆ QPushButtonShowPassword()

QPushButtonShowPassword::QPushButtonShowPassword ( QLineEdit * line,
QWidget * parent = nullptr )
explicit

Construct a show-password button linked to the given QLineEdit.

Parameters
lineQLineEdit whose contents are shown or hidden by this button.
parentOptional parent widget.

Definition at line 11 of file qpushbuttonshowpassword.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ buttonClicked

void QPushButtonShowPassword::buttonClicked ( bool checked)
privateslot

Connected to QPushButton::clicked(bool); flips the echo mode of line and updates icon, tooltip and accessible name accordingly.

Parameters
checkedUnused; the state is read from the line edit.

Definition at line 27 of file qpushbuttonshowpassword.cpp.

Here is the caller graph for this function:

◆ clicked

void QPushButtonShowPassword::clicked ( const QString & text)
signal

Emitted on button activation with the current text of the line edit.

Parameters
textCurrent text of the associated QLineEdit.
Here is the call graph for this function:

Member Data Documentation

◆ iconEdit

QIcon QPushButtonShowPassword::iconEdit
private

view-visible icon shown while the password is hidden.

Definition at line 56 of file qpushbuttonshowpassword.h.

◆ iconEditPushed

QIcon QPushButtonShowPassword::iconEditPushed
private

view-hidden icon shown while the password is revealed.

Definition at line 58 of file qpushbuttonshowpassword.h.

◆ line

QLineEdit* QPushButtonShowPassword::line
private

The line edit being toggled; owned by the caller, must outlive this button.

Definition at line 61 of file qpushbuttonshowpassword.h.


The documentation for this class was generated from the following files: