Mercurial > minori
view 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 source
#ifndef __gui__ui_utils_h #define __gui__ui_utils_h #include <QWidget> #include <QString> #include <QSize> #include <QPlainTextEdit> #include <QLineEdit> class QFrame; class QLabel; namespace TextWidgets { class Header : public QWidget { Q_OBJECT public: Header(QString title, QWidget* parent = nullptr); void SetText(QString title); private: QLabel* static_text_title; QFrame* static_text_line; }; class Paragraph : public QPlainTextEdit { Q_OBJECT public: Paragraph(QString text, QWidget* parent = nullptr); void SetText(QString text); QSize minimumSizeHint() const override; QSize sizeHint() const override; }; class Line : public QLineEdit { Q_OBJECT public: 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(); private: Header* header; Paragraph* paragraph; }; class LabelledSection : public QWidget { Q_OBJECT public: LabelledSection(QString title, QString label, QString data, QWidget* parent = nullptr); Header* GetHeader(); Paragraph* GetLabels(); Paragraph* GetParagraph(); private: Header* header; Paragraph* labels; Paragraph* paragraph; }; class SelectableSection : public QWidget { Q_OBJECT public: SelectableSection(QString title, QString data, QWidget* parent = nullptr); Header* GetHeader(); Paragraph* GetParagraph(); private: Header* header; Paragraph* paragraph; }; class OneLineSection : public QWidget { Q_OBJECT public: OneLineSection(QString title, QString data, QWidget* parent = nullptr); Header* GetHeader(); Line* GetLine(); private: Header* header; Line* line; }; } // namespace TextWidgets #endif // __gui__ui_utils_h