Mercurial > minori
diff include/gui/widgets/text.h @ 46:d0adc4aedfc8
*: update...
this commit:
1. consolidates dark theme stuff to dark_theme.cpp
2. creates a new widgets folder to store all of our
custom widgets
3. creates the list settings page in the information
dialog, although much of it is nonfunctional: it
doesn't save, and the status doesn't even get filled
in... we'll fix this later!
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 23 Sep 2023 01:02:15 -0400 |
parents | |
children | 3d2decf093bb |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/widgets/text.h Sat Sep 23 01:02:15 2023 -0400 @@ -0,0 +1,77 @@ +#ifndef __gui__ui_utils_h +#define __gui__ui_utils_h +#include <QFrame> +#include <QLabel> +#include <QPlainTextEdit> +#include <QSize> +#include <QString> +#include <QWidget> +namespace TextWidgets { +void SetPlainTextEditData(QPlainTextEdit* text_edit, QString data); + +class Header : public QWidget { + Q_OBJECT + + public: + Header(QString title, QWidget* parent = nullptr); + void SetTitle(QString title); + + private: + QLabel* static_text_title; + QFrame* static_text_line; +}; + +class Paragraph : public QPlainTextEdit { + Q_OBJECT + + public: + Paragraph(QString text, QWidget* parent = nullptr); + QSize minimumSizeHint() const override; + 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 { + Q_OBJECT + + public: + TextParagraph(QString title, QString data, QWidget* parent = nullptr); + Header* GetHeader(); + Paragraph* GetParagraph(); + + private: + Header* header; + Paragraph* paragraph; +}; + +class LabelledTextParagraph : public QWidget { + Q_OBJECT + + public: + LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent = nullptr); + Header* GetHeader(); + Paragraph* GetLabels(); + Paragraph* GetParagraph(); + + private: + Header* header; + Paragraph* labels; + Paragraph* paragraph; +}; + +class SelectableTextParagraph : public QWidget { + Q_OBJECT + + public: + SelectableTextParagraph(QString title, QString data, QWidget* parent = nullptr); + Header* GetHeader(); + Paragraph* GetParagraph(); + + private: + Header* header; + Paragraph* paragraph; +}; +}; // namespace UiUtils +#endif // __gui__ui_utils_h