# HG changeset patch # User Paper # Date 1695664256 14400 # Node ID 10868c3fb2be84ca6ed3587f9eb05b353d105b2a # Parent f4bea5ef5b8aab8dd615865673c7e829a7bdb85e text.cpp: set paragraph width from document, labelled texts are now... dependent on sizeHint() diff -r f4bea5ef5b8a -r 10868c3fb2be src/gui/widgets/text.cpp --- 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 {