Mercurial > minori
comparison src/ui_utils.cpp @ 6:1d82f6e04d7d
Update: add first parts to the settings dialog
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Wed, 16 Aug 2023 00:49:17 -0400 |
| parents | 23d0d9319a00 |
| children | 07a9095eaeed |
comparison
equal
deleted
inserted
replaced
| 5:51ae25154b70 | 6:1d82f6e04d7d |
|---|---|
| 3 #ifdef MACOSX | 3 #ifdef MACOSX |
| 4 #include "sys/osx/dark_theme.h" | 4 #include "sys/osx/dark_theme.h" |
| 5 #else | 5 #else |
| 6 #include "sys/win32/dark_theme.h" | 6 #include "sys/win32/dark_theme.h" |
| 7 #endif | 7 #endif |
| 8 | |
| 9 QIcon UiUtils::CreateSideBarIcon(const char* file) { | |
| 10 QPixmap pixmap(file, "PNG"); | |
| 11 QIcon result; | |
| 12 result.addPixmap(pixmap, QIcon::Normal); | |
| 13 result.addPixmap(pixmap, QIcon::Selected); | |
| 14 return result; | |
| 15 } | |
| 8 | 16 |
| 9 bool UiUtils::IsInDarkMode() { | 17 bool UiUtils::IsInDarkMode() { |
| 10 if (session.config.theme != OS) | 18 if (session.config.theme != OS) |
| 11 return (session.config.theme == DARK); | 19 return (session.config.theme == DARK); |
| 12 #ifdef MACOSX | 20 #ifdef MACOSX |
| 46 QPlainTextEdit* UiUtils::CreateTextParagraph(QWidget* parent, QString title, QString data, QPoint point, QSize size) { | 54 QPlainTextEdit* UiUtils::CreateTextParagraph(QWidget* parent, QString title, QString data, QPoint point, QSize size) { |
| 47 CreateTextHeader(parent, title, point, size); | 55 CreateTextHeader(parent, title, point, size); |
| 48 | 56 |
| 49 QPlainTextEdit* paragraph = new QPlainTextEdit(data, parent); | 57 QPlainTextEdit* paragraph = new QPlainTextEdit(data, parent); |
| 50 paragraph->setTextInteractionFlags(Qt::NoTextInteraction); | 58 paragraph->setTextInteractionFlags(Qt::NoTextInteraction); |
| 59 paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents); | |
| 51 paragraph->setWordWrapMode(QTextOption::NoWrap); | 60 paragraph->setWordWrapMode(QTextOption::NoWrap); |
| 52 paragraph->setFrameShape(QFrame::NoFrame); | 61 paragraph->setFrameShape(QFrame::NoFrame); |
| 62 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 63 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 64 paragraph->setStyleSheet("background: transparent;"); | |
| 53 paragraph->move(point.x()+12, point.y()+32); | 65 paragraph->move(point.x()+12, point.y()+32); |
| 54 paragraph->resize(size.width()-12, size.height()-32); | 66 paragraph->resize(size.width()-12, size.height()-32); |
| 55 return paragraph; | 67 return paragraph; |
| 56 } | 68 } |
| 57 | 69 |
| 58 QPlainTextEdit* UiUtils::CreateTextParagraphWithLabels(QWidget* parent, QString title, QString label, QString data, QPoint point, QSize size) { | 70 QPlainTextEdit* UiUtils::CreateTextParagraphWithLabels(QWidget* parent, QString title, QString label, QString data, QPoint point, QSize size) { |
| 59 CreateTextHeader(parent, title, point, size); | 71 CreateTextHeader(parent, title, point, size); |
| 60 | 72 |
| 61 QPlainTextEdit* label_t = new QPlainTextEdit(label, parent); | 73 QPlainTextEdit* label_t = new QPlainTextEdit(label, parent); |
| 62 label_t->setTextInteractionFlags(Qt::NoTextInteraction); | 74 label_t->setTextInteractionFlags(Qt::NoTextInteraction); |
| 75 label_t->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents); | |
| 63 label_t->setWordWrapMode(QTextOption::NoWrap); | 76 label_t->setWordWrapMode(QTextOption::NoWrap); |
| 64 label_t->setFrameShape(QFrame::NoFrame); | 77 label_t->setFrameShape(QFrame::NoFrame); |
| 78 label_t->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 79 label_t->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 80 label_t->setStyleSheet("background: transparent;"); | |
| 65 label_t->move(point.x()+12, point.y()+32); | 81 label_t->move(point.x()+12, point.y()+32); |
| 66 label_t->resize(90, size.height()-32); | 82 label_t->resize(90, size.height()-32); |
| 67 | 83 |
| 68 QPlainTextEdit* paragraph = new QPlainTextEdit(data, parent); | 84 QPlainTextEdit* paragraph = new QPlainTextEdit(data, parent); |
| 69 paragraph->setTextInteractionFlags(Qt::NoTextInteraction); | 85 paragraph->setTextInteractionFlags(Qt::NoTextInteraction); |
| 86 paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents); | |
| 70 paragraph->setWordWrapMode(QTextOption::NoWrap); | 87 paragraph->setWordWrapMode(QTextOption::NoWrap); |
| 71 paragraph->setFrameShape(QFrame::NoFrame); | 88 paragraph->setFrameShape(QFrame::NoFrame); |
| 89 paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 90 paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 91 paragraph->setStyleSheet("background: transparent;"); | |
| 72 paragraph->move(point.x()+102, point.y()+32); | 92 paragraph->move(point.x()+102, point.y()+32); |
| 73 paragraph->resize(size.width()-102, size.height()-32); | 93 paragraph->resize(size.width()-102, size.height()-32); |
| 74 return paragraph; | 94 return paragraph; |
| 75 } | 95 } |
| 76 | 96 |
| 80 CreateTextHeader(parent, title, point, size); | 100 CreateTextHeader(parent, title, point, size); |
| 81 | 101 |
| 82 QPlainTextEdit* text_edit = new QPlainTextEdit(data, parent); | 102 QPlainTextEdit* text_edit = new QPlainTextEdit(data, parent); |
| 83 text_edit->setReadOnly(true); | 103 text_edit->setReadOnly(true); |
| 84 text_edit->setFrameShape(QFrame::NoFrame); | 104 text_edit->setFrameShape(QFrame::NoFrame); |
| 105 text_edit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 106 text_edit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
| 107 text_edit->setStyleSheet("background: transparent;"); | |
| 85 text_edit->move(point.x()+12, point.y()+32); | 108 text_edit->move(point.x()+12, point.y()+32); |
| 86 text_edit->resize(size.width()-12, size.height()-32); | 109 text_edit->resize(size.width()-12, size.height()-32); |
| 87 return text_edit; | 110 return text_edit; |
| 88 } | 111 } |
