Loading...
Searching...
No Matches
ExpandableTextEdit.hpp
1#pragma once
2#include <QByteArray>
3#include <QLineEdit>
4#include <QPointer>
5
6#include <score_lib_state_export.h>
7
8#include <verdigris>
9
10class QAction;
11
12namespace State
13{
30class SCORE_LIB_STATE_EXPORT ExpandableTextEdit final : public QLineEdit
31{
32 W_OBJECT(ExpandableTextEdit)
33public:
34 explicit ExpandableTextEdit(QWidget* parent = nullptr);
36
37 QByteArray fullBytes() const noexcept;
38 void setFullBytes(const QByteArray& b);
39
40 QString fullText() const noexcept;
41 void setFullText(const QString& t);
42
44 void setSubject(QString s);
45
46 bool isMultiLine() const noexcept { return m_multiline; }
47 bool isBinary() const noexcept { return m_binary; }
48
50 bool needsPopup() const noexcept { return m_multiline || m_binary; }
51
53 void expand();
54
56 void expandIfNeeded();
57
58public:
60 void fullTextEdited(const QString& arg_1)
61 E_SIGNAL(SCORE_LIB_STATE_EXPORT, fullTextEdited, arg_1)
62
63private:
64 void mouseDoubleClickEvent(QMouseEvent* ev) override;
65 void changeEvent(QEvent* ev) override;
66
67 void refresh();
68 void refreshIcon();
69
70 QAction* m_expand{};
71 QPointer<QWidget> m_popup;
72 QByteArray m_bytes;
73 QString m_subject;
74 bool m_multiline{};
75 bool m_binary{};
76 bool m_offeredPopup{};
77};
78}
A one-line field with a way out to a full editor.
Definition ExpandableTextEdit.hpp:31
bool needsPopup() const noexcept
The one-line field cannot carry this value: the popup is the only way in.
Definition ExpandableTextEdit.hpp:50
void fullTextEdited(const QString &arg_1)
The popup committed a new value.
Utilities for OSSIA data structures.
Definition DeviceInterface.hpp:35