Loading...
Searching...
No Matches
State::ExpandableTextEdit Class Referencefinal

A one-line field with a way out to a full editor. More...

Inheritance diagram for State::ExpandableTextEdit:

Detailed Description

A one-line field with a way out to a full editor.

The value is held as bytes – ossia's STRING is a std::string, and QLineEdit drops newlines and non-printable characters. The field takes three shapes:

  • one line of text: an ordinary editable line edit;
  • several lines: a read-only first line [+2 lines] summary, whole text in the tooltip, popup to edit;
  • bytes that are not text: a read-only hex preview, popup on its hex pane.

The popup is a Qt::Popup panel: clicking away commits, Escape cancels.

fullBytes() / setFullBytes() are the real accessors; the QString pair is a UTF-8 façade over them.

Public Member Functions

 ExpandableTextEdit (QWidget *parent=nullptr)
 
QByteArray fullBytes () const noexcept
 
void setFullBytes (const QByteArray &b)
 
QString fullText () const noexcept
 
void setFullText (const QString &t)
 
void setSubject (QString s)
 Named in the popup's header, e.g. the address being edited.
 
bool isMultiLine () const noexcept
 
bool isBinary () const noexcept
 
bool needsPopup () const noexcept
 The one-line field cannot carry this value: the popup is the only way in.
 
void expand ()
 Opens the popup under the field.
 
void expandIfNeeded ()
 expand() when needsPopup(); the delegates call it after loading.
 
void fullTextEdited (const QString &arg_1)
 The popup committed a new value.
 

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