Qt Utilities  6.4.1
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
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. More...
 
 ~EnterPasswordDialog () override
 Destroys the password dialog. More...
 
const QString & userName () const
 Returns the entered user name. More...
 
const QString & password () const
 Returns the entered password. More...
 
QString description () const
 Returns the description. More...
 
void setDescription (const QString &description=QString())
 Sets the description. More...
 
bool promtForUserName () const
 Returns whether the dialogs prompts for a user name as well. More...
 
void setPromptForUserName (bool prompt)
 Sets whethere the dialog prompts for a user name as well. More...
 
bool isVerificationRequired () const
 Returns an indication whether a verification (password has to be entered twice) is required. More...
 
void setVerificationRequired (bool value)
 Sets whether a verification (password has to be entered twice) is required. More...
 
bool isPasswordRequired () const
 Returns an indication whether the user is force to enter a password. More...
 
void setPasswordRequired (bool value)
 Sets whether the user is force to enter a password. More...
 
const QString & instruction () const
 Returns the instruction text. More...
 
void setInstruction (const QString &value)
 Sets the instruction text. More...
 

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. More...
 

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. More...
 

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 39 of file enterpassworddialog.cpp.

◆ ~EnterPasswordDialog()

QtUtilities::EnterPasswordDialog::~EnterPasswordDialog ( )
override

Destroys the password dialog.

Definition at line 80 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 89 of file enterpassworddialog.cpp.

◆ event()

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

Definition at line 212 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 235 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 requried 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 147 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 133 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 112 of file enterpassworddialog.cpp.

◆ setDescription()

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

Sets the description.

See also
description()

Definition at line 98 of file enterpassworddialog.cpp.

◆ setInstruction()

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

Sets the instruction text.

See also
EnterPasswordDialog::instruction()

Definition at line 201 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 161 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 121 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 187 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 97 of file enterpassworddialog.h.

◆ instruction

QString QtUtilities::EnterPasswordDialog::instruction
readwrite

Definition at line 97 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 97 of file enterpassworddialog.h.

◆ isPasswordRequired

bool QtUtilities::EnterPasswordDialog::isPasswordRequired
readwrite

Definition at line 97 of file enterpassworddialog.h.

◆ isVerificationRequired

bool QtUtilities::EnterPasswordDialog::isVerificationRequired
readwrite

Definition at line 97 of file enterpassworddialog.h.

◆ password

QString QtUtilities::EnterPasswordDialog::password
read

Definition at line 97 of file enterpassworddialog.h.

◆ promtForUserName

bool QtUtilities::EnterPasswordDialog::promtForUserName
readwrite

Definition at line 97 of file enterpassworddialog.h.

◆ userName

QString QtUtilities::EnterPasswordDialog::userName
read

Definition at line 97 of file enterpassworddialog.h.


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