The name of a key: value field in PasswordDialog, editable in place: double-click or the context menu renames it, the context menu can also remove the field (#132).
More...
#include <fieldlabel.h>
|
| void | startEdit () |
| | Open the in-place editor over the label.
|
|
| void | renamed (const QString &from, const QString &to) |
| | The user typed a different name and confirmed it.
|
| void | removeRequested () |
| | The user chose "Remove field".
|
|
| | FieldLabel (const QString &name, QWidget *parent=nullptr) |
| | Label for the field called name.
|
| | ~FieldLabel () override |
| | Takes an open editor with it: the editor is a sibling, not a child, so it would otherwise stay behind when the field is removed while its name is being edited.
|
|
| void | mouseDoubleClickEvent (QMouseEvent *event) override |
| | A left double-click starts editing the name.
|
| void | contextMenuEvent (QContextMenuEvent *event) override |
| | Menu with Rename field and Remove field.
|
| auto | eventFilter (QObject *watched, QEvent *event) -> bool override |
| | Escape in the editor cancels the edit.
|
|
| void | finishEdit (bool commit) |
| | Close the editor, putting the label back in its place.
|
|
| QPointer< QLineEdit > | m_editor |
| | The line edit open over the label while a rename is in progress; null otherwise. A sibling in the parent's form layout rather than a child, so the destructor deletes it explicitly.
|
The name of a key: value field in PasswordDialog, editable in place: double-click or the context menu renames it, the context menu can also remove the field (#132).
The label only reports what the user asked for; PasswordDialog owns the line edit the field belongs to and decides whether a new name is usable.
Definition at line 26 of file fieldlabel.h.
◆ FieldLabel()
| FieldLabel::FieldLabel |
( |
const QString & | name, |
|
|
QWidget * | parent = nullptr ) |
|
explicit |
Label for the field called name.
- Parameters
-
| name | the field's key, as shown and as written back |
| parent | owning widget |
Definition at line 16 of file fieldlabel.cpp.
◆ ~FieldLabel()
| FieldLabel::~FieldLabel |
( |
| ) |
|
|
override |
Takes an open editor with it: the editor is a sibling, not a child, so it would otherwise stay behind when the field is removed while its name is being edited.
Definition at line 40 of file fieldlabel.cpp.
◆ contextMenuEvent()
| void FieldLabel::contextMenuEvent |
( |
QContextMenuEvent * | event | ) |
|
|
overrideprotected |
Menu with Rename field and Remove field.
- Parameters
-
| event | the context menu event |
Definition at line 33 of file fieldlabel.cpp.
◆ eventFilter()
| auto FieldLabel::eventFilter |
( |
QObject * | watched, |
|
|
QEvent * | event ) -> bool |
|
overrideprotected |
Escape in the editor cancels the edit.
- Parameters
-
| watched | the editor |
| event | the event to inspect |
- Returns
- true when the event was consumed
Definition at line 72 of file fieldlabel.cpp.
◆ finishEdit()
| void FieldLabel::finishEdit |
( |
bool | commit | ) |
|
|
private |
Close the editor, putting the label back in its place.
- Parameters
-
| commit | emit renamed() for a changed, non-empty name |
Definition at line 91 of file fieldlabel.cpp.
◆ mouseDoubleClickEvent()
| void FieldLabel::mouseDoubleClickEvent |
( |
QMouseEvent * | event | ) |
|
|
overrideprotected |
A left double-click starts editing the name.
- Parameters
-
Definition at line 25 of file fieldlabel.cpp.
◆ removeRequested
| void FieldLabel::removeRequested |
( |
| ) |
|
|
signal |
The user chose "Remove field".
◆ renamed
| void FieldLabel::renamed |
( |
const QString & | from, |
|
|
const QString & | to ) |
|
signal |
The user typed a different name and confirmed it.
- Parameters
-
| from | the name before, still shown until the receiver accepts |
| to | the new name, trimmed, never empty, without a colon |
◆ startEdit
| void FieldLabel::startEdit |
( |
| ) |
|
|
slot |
Open the in-place editor over the label.
Definition at line 42 of file fieldlabel.cpp.
◆ m_editor
| QPointer<QLineEdit> FieldLabel::m_editor |
|
private |
The line edit open over the label while a rename is in progress; null otherwise. A sibling in the parent's form layout rather than a child, so the destructor deletes it explicitly.
Definition at line 92 of file fieldlabel.h.
The documentation for this class was generated from the following files: