From 634b59f187c8697f03a606cbacb5f0a69650ea7c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 27 Feb 2019 19:48:22 +0100 Subject: Text: render table cell backgrounds properly QQuickTextNodeEngine::addTextBlock() was noticing the background color of text fragments, including those within table cells (and adding to the colorChanges vector for rendering), but not rendering a rectangle for the background of the entire table cell. So while the color was correct, it only took up as much space as the text itself. Also, QTextDocumentLayout needs to be told how much width is available so that QTextDocumentLayoutPrivate::layoutTable() will allocate cell width appropriately in case width is given as a percentage, e.g. . This is done by calling QTextDocument::setPageSize() with correct width in pixels rather than zero. Fixes: QTBUG-72457 Change-Id: I5c8f861829f76d1cf4044fccd1142c3817bb33bc Reviewed-by: Andy Shaw Reviewed-by: Lars Knoll --- src/quick/items/qquicktext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick/items/qquicktext.cpp') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index dd7fbccff5..8b6f59497f 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -442,7 +442,7 @@ void QQuickTextPrivate::updateSize() if (internalWidthUpdate) return; - extra->doc->setPageSize(QSizeF()); + extra->doc->setPageSize(QSizeF(q->width(), -1)); if (q->widthValid() && (wrapMode != QQuickText::NoWrap || extra->doc->idealWidth() < availableWidth())) extra->doc->setTextWidth(availableWidth()); else @@ -1247,7 +1247,7 @@ void QQuickTextPrivate::ensureDoc() if (!extra.isAllocated() || !extra->doc) { Q_Q(QQuickText); extra.value().doc = new QQuickTextDocumentWithImageResources(q); - extra->doc->setPageSize(QSizeF(0, 0)); + extra->doc->setPageSize(QSizeF(q->width(), -1)); extra->doc->setDocumentMargin(0); extra->doc->setBaseUrl(q->baseUrl()); qmlobject_connect(extra->doc, QQuickTextDocumentWithImageResources, SIGNAL(imagesLoaded()), -- cgit v1.2.3