KPasswordLineEdit Class
A lineedit which allows to display password. More...
Header: | #include <KPasswordLineEdit> |
CMake: | find_package(KF6 REQUIRED COMPONENTS WidgetsAddons) target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons) |
Since: | 5.37 |
Inherits: | QWidget |
Properties
- clearButtonEnabled : bool
- echoMode : QLineEdit::EchoMode
- password : QString
Public Functions
(since 5.37) | KPasswordLineEdit(QWidget *parent = nullptr) |
void | clear() |
QLineEdit::EchoMode | echoMode() const |
bool | isClearButtonEnabled() const |
(since 6.0) bool | isReadOnly() const |
QLineEdit * | lineEdit() const |
QString | password() const |
(since 6.0) KPassword::RevealMode | revealPasswordMode() const |
void | setClearButtonEnabled(bool clear) |
void | setEchoMode(QLineEdit::EchoMode mode) |
void | setPassword(const QString &password) |
(since 6.0) void | setReadOnly(bool readOnly) |
Signals
void | echoModeChanged(QLineEdit::EchoMode echoMode) |
void | passwordChanged(const QString &password) |
Detailed Description
Usage Example:
Get password
KPasswordLineEdit *passwordLineEdit = new KPasswordLineEdit(parent); QString password = passwordLineEdit->password();
Property Documentation
clearButtonEnabled : bool
Access functions:
bool | isClearButtonEnabled() const |
void | setClearButtonEnabled(bool clear) |
echoMode : QLineEdit::EchoMode
Access functions:
QLineEdit::EchoMode | echoMode() const |
void | setEchoMode(QLineEdit::EchoMode mode) |
Notifier signal:
void | echoModeChanged(QLineEdit::EchoMode echoMode) |
password : QString
Access functions:
QString | password() const |
void | setPassword(const QString &password) |
Notifier signal:
void | passwordChanged(const QString &password) |
Member Function Documentation
[explicit, since 5.37]
KPasswordLineEdit::KPasswordLineEdit(QWidget *parent = nullptr)
Constructs a lineedit password widget.
parent Passed to lower level constructor.
This function was introduced in 5.37.
void KPasswordLineEdit::clear()
Clear text
QLineEdit::EchoMode KPasswordLineEdit::echoMode() const
Return echo mode
Note: Getter function for property echoMode.
See also setEchoMode().
[signal]
void KPasswordLineEdit::echoModeChanged(QLineEdit::EchoMode echoMode)
When we click on visibility icon echo mode is switched between Normal echo mode and Password echo mode
Note: Notifier signal for property echoMode.
bool KPasswordLineEdit::isClearButtonEnabled() const
Inform if we show or not clear button
Note: Getter function for property clearButtonEnabled.
[since 6.0]
bool KPasswordLineEdit::isReadOnly() const
Return whether the line edit is read only.
This function was introduced in 6.0.
QLineEdit *KPasswordLineEdit::lineEdit() const
Returns the lineedit widget.
QString KPasswordLineEdit::password() const
Returns the password entered.
Note: Getter function for property password.
See also setPassword().
[signal]
void KPasswordLineEdit::passwordChanged(const QString &password)
Note: Notifier signal for property password.
[since 6.0]
KPassword::RevealMode KPasswordLineEdit::revealPasswordMode() const
Return when the reveal password button is visible.
This function was introduced in 6.0.
void KPasswordLineEdit::setClearButtonEnabled(bool clear)
Show/hide clear button (false by default)
Note: Setter function for property clearButtonEnabled.
See also isClearButtonEnabled().
void KPasswordLineEdit::setEchoMode(QLineEdit::EchoMode mode)
Change echo mode (QLineEdit::Password by default)
Note: Setter function for property echoMode.
See also echoMode().
void KPasswordLineEdit::setPassword(const QString &password)
Assign password
Note: Setter function for property password.
See also password().
[since 6.0]
void KPasswordLineEdit::setReadOnly(bool readOnly)
Set whether the line edit is read only.
This function was introduced in 6.0.
See also isReadOnly().