Mercurial > minori
comparison include/gui/widgets/text.h @ 291:9a88e1725fd2
*: refactor lots of stuff
I forgot to put this into different commits, oops!
anyway, it doesn't really matter *that* much since this is an
unfinished hobby project anyway. once it starts getting stable
commit history will be more important, but for now it's not
that big of a deal
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 12 May 2024 16:31:07 -0400 |
parents | 3ec7804abf17 |
children | b82841e76e79 |
comparison
equal
deleted
inserted
replaced
290:9347e2eaf6e5 | 291:9a88e1725fd2 |
---|---|
19 public: | 19 public: |
20 Header(const QString& title, QWidget* parent = nullptr); | 20 Header(const QString& title, QWidget* parent = nullptr); |
21 void SetText(const QString& title); | 21 void SetText(const QString& title); |
22 | 22 |
23 private: | 23 private: |
24 QLabel* static_text_title; | 24 QLabel static_text_title; |
25 QFrame* static_text_line; | 25 QFrame static_text_line; |
26 }; | 26 }; |
27 | 27 |
28 class Paragraph : public QLabel { | 28 class Paragraph : public QWidget { |
29 Q_OBJECT | 29 Q_OBJECT |
30 | 30 |
31 public: | 31 public: |
32 Paragraph(const QString& text, QWidget* parent = nullptr); | 32 Paragraph(const QString& text, QWidget* parent = nullptr); |
33 void SetText(const QString& text); | 33 void SetText(const QString& text); |
34 QPlainTextEdit* GetLabel(); | |
35 | |
36 protected: | |
37 QSize minimumSizeHint() const; | |
38 QSize sizeHint() const; | |
39 | |
40 private: | |
41 QPlainTextEdit text_edit; | |
34 }; | 42 }; |
35 | 43 |
36 class LabelledParagraph final : public QWidget { | 44 class LabelledParagraph final : public QWidget { |
37 Q_OBJECT | 45 Q_OBJECT |
38 | 46 |
39 public: | 47 public: |
40 LabelledParagraph(const QString& label, const QString& data, QWidget* parent = nullptr); | 48 LabelledParagraph(const QString& label, const QString& data, QWidget* parent = nullptr); |
41 Paragraph* GetLabels(); | 49 QLabel* GetLabels(); |
42 Paragraph* GetParagraph(); | 50 QLabel* GetData(); |
51 | |
52 /* synonymous with GetData(), kept for compatibility. don't use in new code!!! */ | |
53 QLabel* GetParagraph(); | |
43 | 54 |
44 private: | 55 private: |
45 Paragraph* labels; | 56 QLabel labels_; |
46 Paragraph* paragraph; | 57 QLabel data_; |
47 }; | 58 }; |
48 | 59 |
49 class Line : public Paragraph { | 60 class Line : public QWidget { |
50 Q_OBJECT | 61 Q_OBJECT |
51 | 62 |
52 public: | 63 public: |
53 Line(QWidget* parent = nullptr); | 64 Line(QWidget* parent = nullptr); |
54 Line(const QString& text, QWidget* parent = nullptr); | 65 Line(const QString& text, QWidget* parent = nullptr); |
55 void SetText(const QString& text); | 66 void SetText(const QString& text); |
67 | |
68 protected: | |
69 QLineEdit line_edit_; | |
56 }; | 70 }; |
57 | 71 |
58 class Title final : public Line { | 72 class Title final : public Line { |
59 Q_OBJECT | 73 Q_OBJECT |
60 | 74 |
79 Q_OBJECT | 93 Q_OBJECT |
80 | 94 |
81 public: | 95 public: |
82 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr); | 96 LabelledSection(const QString& title, const QString& label, const QString& data, QWidget* parent = nullptr); |
83 Header* GetHeader(); | 97 Header* GetHeader(); |
84 Paragraph* GetLabels(); | 98 QLabel* GetLabels(); |
85 Paragraph* GetParagraph(); | 99 QLabel* GetData(); |
100 QLabel* GetParagraph(); | |
86 | 101 |
87 private: | 102 private: |
88 Header* header; | 103 Header* header; |
89 LabelledParagraph* content; | 104 LabelledParagraph* content; |
90 }; | 105 }; |