Qt Utilities 6.14.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
QtUtilities::EnterPasswordDialog Class Reference

The EnterPasswordDialog class provides a simple dialog to ask the user for a password. More...

#include <enterpassworddialog.h>

Inheritance diagram for QtUtilities::EnterPasswordDialog:
[legend]
Collaboration diagram for QtUtilities::EnterPasswordDialog:
[legend]

Public Member Functions

 EnterPasswordDialog (QWidget *parent=nullptr)
 Constructs a password dialog.
 
 ~EnterPasswordDialog () override
 Destroys the password dialog.
 
const QString & userName () const
 Returns the entered user name.
 
const QString & password () const
 Returns the entered password.
 
QString description () const
 Returns the description.
 
void setDescription (const QString &description=QString())
 Sets the description.
 
bool promtForUserName () const
 Returns whether the dialogs prompts for a user name as well.
 
void setPromptForUserName (bool prompt)
 Sets whethere the dialog prompts for a user name as well.
 
bool isVerificationRequired () const
 Returns an indication whether a verification (password has to be entered twice) is required.
 
void setVerificationRequired (bool value)
 Sets whether a verification (password has to be entered twice) is required.
 
bool isPasswordRequired () const
 Returns an indication whether the user is force to enter a password.
 
void setPasswordRequired (bool value)
 Sets whether the user is force to enter a password.
 
const QString & instruction () const
 Returns the instruction text.
 
void setInstruction (const QString &value)
 Sets the instruction text.
 

Static Public Member Functions

static bool isCapslockPressed ()
 

Protected Member Functions

bool event (QEvent *event) override
 
bool eventFilter (QObject *sender, QEvent *event) override
 Internal method to notice when the capslock key is pressed by the user.
 

Properties

QString userName
 
QString password
 
QString description
 
bool promtForUserName
 
bool isVerificationRequired
 
bool isPasswordRequired
 
QString instruction
 
bool isCapslockPressed
 Returns an indication whether the capslock key is pressed using platform specific functions.
 

Detailed Description

The EnterPasswordDialog class provides a simple dialog to ask the user for a password.

Definition at line 16 of file enterpassworddialog.h.

Constructor & Destructor Documentation

◆ EnterPasswordDialog()

QtUtilities::EnterPasswordDialog::EnterPasswordDialog ( QWidget * parent = nullptr)
explicit

Constructs a password dialog.

Parameters
parentSpecifies the parent widget.

Definition at line 37 of file enterpassworddialog.cpp.

◆ ~EnterPasswordDialog()

QtUtilities::EnterPasswordDialog::~EnterPasswordDialog ( )
override

Destroys the password dialog.

Definition at line 73 of file enterpassworddialog.cpp.

Member Function Documentation

◆ description()

QString QtUtilities::EnterPasswordDialog::description ( ) const

Returns the description.

The description is shown under the instruction text.

See also
setDescription()

Definition at line 82 of file enterpassworddialog.cpp.

◆ event()

bool QtUtilities::EnterPasswordDialog::event ( QEvent * event)
overrideprotected

Definition at line 205 of file enterpassworddialog.cpp.

◆ eventFilter()

bool QtUtilities::EnterPasswordDialog::eventFilter ( QObject * sender,
QEvent * event )
overrideprotected

Internal method to notice when the capslock key is pressed by the user.

Invocation of this method is done by installing the event filter in the constructor.

Definition at line 234 of file enterpassworddialog.cpp.

◆ instruction()

const QString & QtUtilities::EnterPasswordDialog::instruction ( ) const
inline

Returns the instruction text.

The instruction text is displayed at the top of the dialog. If the instruction text is empty the default text "Enter the new password" or "Enter the password" (depending on whether the verification is required or not) displayed.

See also
EnterPasswordDialog::setInstruction()

Definition at line 87 of file enterpassworddialog.h.

◆ isCapslockPressed()

static bool QtUtilities::EnterPasswordDialog::isCapslockPressed ( )
static

◆ isPasswordRequired()

bool QtUtilities::EnterPasswordDialog::isPasswordRequired ( ) const

Returns an indication whether the user is force to enter a password.

If no password is required, the user is allowed to skip the dialog without entering a password.

See also
EnterPasswordDialog::setPasswordRequired()

Definition at line 140 of file enterpassworddialog.cpp.

◆ isVerificationRequired()

bool QtUtilities::EnterPasswordDialog::isVerificationRequired ( ) const

Returns an indication whether a verification (password has to be entered twice) is required.

See also
EnterPasswordDialog::setVerificationRequired()

Definition at line 126 of file enterpassworddialog.cpp.

◆ password()

const QString & QtUtilities::EnterPasswordDialog::password ( ) const
inline

Returns the entered password.

Definition at line 72 of file enterpassworddialog.h.

◆ promtForUserName()

bool QtUtilities::EnterPasswordDialog::promtForUserName ( ) const

Returns whether the dialogs prompts for a user name as well.

The dialog does not prompt for a user name by default.

See also
setPromptForUserName()

Definition at line 105 of file enterpassworddialog.cpp.

◆ setDescription()

void QtUtilities::EnterPasswordDialog::setDescription ( const QString & description = QString())

Sets the description.

See also
description()

Definition at line 91 of file enterpassworddialog.cpp.

◆ setInstruction()

void QtUtilities::EnterPasswordDialog::setInstruction ( const QString & value)

Sets the instruction text.

See also
EnterPasswordDialog::instruction()

Definition at line 194 of file enterpassworddialog.cpp.

◆ setPasswordRequired()

void QtUtilities::EnterPasswordDialog::setPasswordRequired ( bool value)

Sets whether the user is force to enter a password.

If no password is required, the user is allowed to skip the dialog without entering a password.

See also
EnterPasswordDialog::isPasswordRequired()

Definition at line 154 of file enterpassworddialog.cpp.

◆ setPromptForUserName()

void QtUtilities::EnterPasswordDialog::setPromptForUserName ( bool prompt)

Sets whethere the dialog prompts for a user name as well.

See also
promptForUserName()

Definition at line 114 of file enterpassworddialog.cpp.

◆ setVerificationRequired()

void QtUtilities::EnterPasswordDialog::setVerificationRequired ( bool value)

Sets whether a verification (password has to be entered twice) is required.

See also
EnterPasswordDialog::isVerificationRequired()

Definition at line 180 of file enterpassworddialog.cpp.

◆ userName()

const QString & QtUtilities::EnterPasswordDialog::userName ( ) const
inline

Returns the entered user name.

Definition at line 64 of file enterpassworddialog.h.

Property Documentation

◆ description

QString QtUtilities::EnterPasswordDialog::description
readwrite

Definition at line 20 of file enterpassworddialog.h.

◆ instruction

QString QtUtilities::EnterPasswordDialog::instruction
readwrite

Definition at line 24 of file enterpassworddialog.h.

◆ isCapslockPressed

bool QtUtilities::EnterPasswordDialog::isCapslockPressed
read

Returns an indication whether the capslock key is pressed using platform specific functions.

Remarks
  • Returns always false for unsupported platforms.
  • This method always returns false when the detection is not supported. It is supported under X11 and Windows.
  • The function requires the application to be linked against X11 on Linux/Unix.
  • This static function will be used internally to detect whether the capslock key is pressed when initializing the dialog.

Definition at line 25 of file enterpassworddialog.h.

◆ isPasswordRequired

bool QtUtilities::EnterPasswordDialog::isPasswordRequired
readwrite

Definition at line 23 of file enterpassworddialog.h.

◆ isVerificationRequired

bool QtUtilities::EnterPasswordDialog::isVerificationRequired
readwrite

Definition at line 22 of file enterpassworddialog.h.

◆ password

QString QtUtilities::EnterPasswordDialog::password
read

Definition at line 19 of file enterpassworddialog.h.

◆ promtForUserName

bool QtUtilities::EnterPasswordDialog::promtForUserName
readwrite

Definition at line 21 of file enterpassworddialog.h.

◆ userName

QString QtUtilities::EnterPasswordDialog::userName
read

Definition at line 18 of file enterpassworddialog.h.


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