Mercurial > minori
diff include/gui/widgets/text.h @ 75:d3e9310598b1
*: refactor some stuff
text: "TextParagraph"s are now called sections, because that's the
actual word for it :P
text: new classes: Line and OneLineSection, solves many problems with
paragraphs that are only one line long (ex. going out of bounds)
http: reworked http stuff to allow threaded get requests, also moved it
to its own file to (hopefully) remove clutter
eventually I'll make a threaded post request method and use that in
the "basic" function
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 04 Oct 2023 01:42:30 -0400 |
parents | 27a19dd6cba1 |
children | 3364fadc8a36 |
line wrap: on
line diff
--- a/include/gui/widgets/text.h Tue Oct 03 06:12:43 2023 -0400 +++ b/include/gui/widgets/text.h Wed Oct 04 01:42:30 2023 -0400 @@ -5,6 +5,7 @@ #include <QString> #include <QSize> #include <QPlainTextEdit> +#include <QLineEdit> class QFrame; class QLabel; @@ -33,14 +34,25 @@ QSize sizeHint() const override; }; -/* technically a paragraph and a heading is actually a - "section", but that name is equally as confusing as - "text paragraph". */ -class TextParagraph : public QWidget { +class Line : public QLineEdit { Q_OBJECT public: - TextParagraph(QString title, QString data, QWidget* parent = nullptr); + Line(QString text, QWidget* parent = nullptr); +}; + +class Title : public Line { + Q_OBJECT + + public: + Title(QString title, QWidget* parent = nullptr); +}; + +class Section : public QWidget { + Q_OBJECT + + public: + Section(QString title, QString data, QWidget* parent = nullptr); Header* GetHeader(); Paragraph* GetParagraph(); @@ -49,11 +61,11 @@ Paragraph* paragraph; }; -class LabelledTextParagraph : public QWidget { +class LabelledSection : public QWidget { Q_OBJECT public: - LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr); + LabelledSection(QString title, QString label, QString data, QWidget* parent = nullptr); Header* GetHeader(); Paragraph* GetLabels(); Paragraph* GetParagraph(); @@ -64,11 +76,11 @@ Paragraph* paragraph; }; -class SelectableTextParagraph : public QWidget { +class SelectableSection : public QWidget { Q_OBJECT public: - SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr); + SelectableSection(QString title, QString data, QWidget* parent = nullptr); Header* GetHeader(); Paragraph* GetParagraph(); @@ -77,11 +89,17 @@ Paragraph* paragraph; }; -class Title : public Paragraph { +class OneLineSection : public QWidget { Q_OBJECT public: - Title(QString title, QWidget* parent = nullptr); + OneLineSection(QString title, QString data, QWidget* parent = nullptr); + Header* GetHeader(); + Line* GetLine(); + + private: + Header* header; + Line* line; }; } // namespace TextWidgets