annotate src/gui/ui_utils.cpp @ 38:1a34fd7469b9

ci/osx: take a different approach
author Paper <mrpapersonic@gmail.com>
date Fri, 22 Sep 2023 09:29:20 -0400
parents 2743011a6042
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
1 /**
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
2 * FIXME: most of these can actually be rerouted to *separate* files.
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
3 * Please do this! It makes everything cleaner :)
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
4 **/
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
5 #include "gui/ui_utils.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
6 #include "core/session.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
7 #include <QFrame>
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
8 #include <QLabel>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
9 #include <QPixmap>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
10 #include <QTextBlock>
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
11 #include <QVBoxLayout>
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
12 #ifdef MACOSX
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
13 # include "sys/osx/dark_theme.h"
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
14 #else
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
15 # include "sys/win32/dark_theme.h"
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
16 #endif
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
17
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
18 namespace UiUtils {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
19
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
20 bool IsInDarkMode() {
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
21 if (session.config.theme != Themes::OS)
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
22 return (session.config.theme == Themes::DARK);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
23 #ifdef MACOSX
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
24 if (osx::DarkThemeAvailable()) {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
25 if (osx::IsInDarkTheme()) {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
26 return true;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
27 } else {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
28 return false;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
29 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
30 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
31 #elif defined(WIN32)
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
32 if (win32::DarkThemeAvailable()) {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
33 if (win32::IsInDarkTheme()) {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
34 return true;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
35 } else {
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
36 return false;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
37 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
38 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
39 #endif
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
40 return (session.config.theme == Themes::DARK);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
41 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
42
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
43 Header::Header(QString title, QWidget* parent) : QWidget(parent) {
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
44 setLayout(new QVBoxLayout);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
45 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
46
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
47 static_text_title = new QLabel(title, this);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
48 static_text_title->setTextFormat(Qt::PlainText);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
49 QFont font = static_text_title->font();
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
50 font.setWeight(QFont::Bold);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
51 static_text_title->setFont(font);
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
52 static_text_title->setFixedHeight(16);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
53
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
54 static_text_line = new QFrame(this);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
55 static_text_line->setFrameShape(QFrame::HLine);
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
56 static_text_line->setFrameShadow(QFrame::Sunken);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
57 static_text_line->setFixedHeight(2);
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
58
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
59 layout()->addWidget(static_text_title);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
60 layout()->addWidget(static_text_line);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
61 layout()->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
62 layout()->setMargin(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
63 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
64
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
65 void Header::SetTitle(QString title) {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
66 static_text_title->setText(title);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
67 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
68
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
69 TextParagraph::TextParagraph(QString title, QString data, QWidget* parent) : QWidget(parent) {
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
70 setLayout(new QVBoxLayout);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
71
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
72 header = new Header(title, this);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
73
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
74 QWidget* content = new QWidget(this);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
75 content->setLayout(new QHBoxLayout);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
76
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
77 paragraph = new Paragraph(data, this);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
78 paragraph->setTextInteractionFlags(Qt::NoTextInteraction);
6
1d82f6e04d7d Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents: 2
diff changeset
79 paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
80 paragraph->setWordWrapMode(QTextOption::NoWrap);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
81
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
82 content->layout()->addWidget(paragraph);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
83 content->layout()->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
84 content->layout()->setMargin(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
85 content->setContentsMargins(12, 0, 0, 0);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
86
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
87 layout()->addWidget(header);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
88 layout()->addWidget(paragraph);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
89 layout()->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
90 layout()->setMargin(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
91 }
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
92
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
93 Header* TextParagraph::GetHeader() {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
94 return header;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
95 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
96
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
97 Paragraph* TextParagraph::GetParagraph() {
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
98 return paragraph;
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
99 }
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
100
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
101 LabelledTextParagraph::LabelledTextParagraph(QString title, QString label, QString data, QWidget* parent)
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
102 : QWidget(parent) {
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
103 setLayout(new QVBoxLayout);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
104
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
105 header = new Header(title, this);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
106
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
107 // this is not accessible from the object because there's really
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
108 // no reason to make it accessible...
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
109 QWidget* content = new QWidget(this);
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
110 content->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
111
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
112 labels = new Paragraph(label, this);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
113 labels->setTextInteractionFlags(Qt::NoTextInteraction);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
114 labels->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
115 labels->setWordWrapMode(QTextOption::NoWrap);
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
116 labels->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
117 labels->setFixedWidth(123);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
118
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
119 paragraph = new Paragraph(data, this);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
120 paragraph->setTextInteractionFlags(Qt::NoTextInteraction);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
121 paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
122 paragraph->setWordWrapMode(QTextOption::NoWrap);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
123
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
124 QHBoxLayout* content_layout = new QHBoxLayout;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
125 content_layout->addWidget(labels, 0, Qt::AlignTop);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
126 content_layout->addWidget(paragraph, 0, Qt::AlignTop);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
127 content_layout->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
128 content_layout->setMargin(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
129 content->setLayout(content_layout);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
130
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
131 content->setContentsMargins(12, 0, 0, 0);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
132
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
133 layout()->addWidget(header);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
134 layout()->addWidget(content);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
135 layout()->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
136 layout()->setMargin(0);
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
137 }
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
138
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
139 Header* LabelledTextParagraph::GetHeader() {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
140 return header;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
141 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
142
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
143 Paragraph* LabelledTextParagraph::GetLabels() {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
144 return labels;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
145 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
146
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
147 Paragraph* LabelledTextParagraph::GetParagraph() {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
148 return paragraph;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
149 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
150
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
151 SelectableTextParagraph::SelectableTextParagraph(QString title, QString data, QWidget* parent) : QWidget(parent) {
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
152 setLayout(new QVBoxLayout);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
153
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
154 header = new Header(title, this);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
155
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
156 QWidget* content = new QWidget(this);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
157 content->setLayout(new QHBoxLayout);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
158
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
159 paragraph = new Paragraph(data, content);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
160
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
161 content->layout()->addWidget(paragraph);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
162 content->layout()->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
163 content->layout()->setMargin(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
164 content->setContentsMargins(12, 0, 0, 0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
165
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
166 layout()->addWidget(header);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
167 layout()->addWidget(content);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
168 layout()->setSpacing(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
169 layout()->setMargin(0);
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
170 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
171
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
172 Header* SelectableTextParagraph::GetHeader() {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
173 return header;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
174 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
175
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
176 Paragraph* SelectableTextParagraph::GetParagraph() {
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
177 return paragraph;
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
178 }
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
179
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
180 void SetPlainTextEditData(QPlainTextEdit* text_edit, QString data) {
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
181 QTextDocument* document = new QTextDocument(text_edit);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
182 document->setDocumentLayout(new QPlainTextDocumentLayout(document));
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
183 document->setPlainText(data);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
184 text_edit->setDocument(document);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
185 }
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
186
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
187 /* inherits QPlainTextEdit and gives a much more reasonable minimum size */
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
188 Paragraph::Paragraph(QString text, QWidget* parent) : QPlainTextEdit(text, parent) {
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
189 setReadOnly(true);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
190 setTextInteractionFlags(Qt::TextBrowserInteraction);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
191 setFrameShape(QFrame::NoFrame);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
192 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
193 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
36
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
194
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
195 QPalette pal;
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
196 pal.setColor(QPalette::Window, QColor(0, 0, 0, 0));
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
197 setPalette(pal);
2743011a6042 *: mass update
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
198
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
199 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
200 }
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
201
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
202 /* highly based upon... some stackoverflow answer for PyQt */
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
203 QSize Paragraph::minimumSizeHint() const {
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
204 QTextDocument* doc = document();
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
205 long h = (long)(blockBoundingGeometry(doc->findBlockByNumber(doc->blockCount() - 1)).bottom() +
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
206 (2 * doc->documentMargin()));
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
207 return QSize(QPlainTextEdit::sizeHint().width(), h);
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
208 }
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
209
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
210 QSize Paragraph::sizeHint() const {
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
211 return minimumSizeHint();
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
212 }
8
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
213
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
214 } // namespace UiUtils
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
215
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 8
diff changeset
216 #include "gui/moc_ui_utils.cpp"