Mercurial > minori
changeset 50:10868c3fb2be
text.cpp: set paragraph width from document, labelled texts are now...
dependent on sizeHint()
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 25 Sep 2023 13:50:56 -0400 |
parents | f4bea5ef5b8a |
children | 75c804f713b2 |
files | src/gui/widgets/text.cpp |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gui/widgets/text.cpp Mon Sep 25 11:40:14 2023 -0400 +++ b/src/gui/widgets/text.cpp Mon Sep 25 13:50:56 2023 -0400 @@ -83,19 +83,17 @@ labels->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents); labels->setWordWrapMode(QTextOption::NoWrap); labels->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - labels->setFixedWidth(123); paragraph = new Paragraph(data, this); paragraph->setTextInteractionFlags(Qt::NoTextInteraction); paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents); paragraph->setWordWrapMode(QTextOption::NoWrap); - QHBoxLayout* content_layout = new QHBoxLayout; + QHBoxLayout* content_layout = new QHBoxLayout(content); content_layout->addWidget(labels, 0, Qt::AlignTop); content_layout->addWidget(paragraph, 0, Qt::AlignTop); - content_layout->setSpacing(0); + content_layout->setSpacing(20); content_layout->setMargin(0); - content->setLayout(content_layout); content->setContentsMargins(12, 0, 0, 0); @@ -169,7 +167,7 @@ for (QTextBlock line = doc->begin(); line != doc->end(); line = line.next()) { h += doc->documentLayout()->blockBoundingRect(line).height(); } - return QSize(QPlainTextEdit::sizeHint().width(), h); + return QSize(doc->size().width(), h); } QSize Paragraph::sizeHint() const {