ResizableTextEdit: Store current text

This commit is contained in:
Jonas Kvinge 2024-08-06 23:23:27 +02:00
parent dc8520ebec
commit 40f3e828aa
2 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,8 @@ void ResizableTextEdit::resizeEvent(QResizeEvent *e) {
void ResizableTextEdit::SetText(const QString &text) {
text_ = text;
QTextEdit::setText(text);
updateGeometry();

View File

@ -32,12 +32,16 @@ class ResizableTextEdit : public QTextEdit {
virtual QSize sizeHint() const override;
QString text() const { return Text(); }
QString Text() const { return text_; }
void setText(const QString &text) { SetText(text); }
void SetText(const QString &text);
protected:
virtual void resizeEvent(QResizeEvent *event) override;
private:
QString text_;
};
#endif // RESIZABLETEXTEDIT_H