From 81554aca81ec4e161ff9fa236e3d76fa950fec97 Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Wed, 17 Jul 2019 21:05:44 +0200 Subject: [PATCH] QTextDocumentLayout: Fix regression in table column width calculation 87748cc18e6a0d9e65933aa2462dc78ab8f9f22e introduces rounding of column widths to avoid table border render artifacts. For variable columns we must make sure that the maxWidth (= unwrapped content width) is not rounded down as this can cause erroneous wrapping of the content at rendering time. Fixes: QTBUG-43589 Change-Id: Iee155702a12374116a63050e5025df91f097a8e4 Reviewed-by: Shawn Rutledge --- src/gui/text/qtextdocumentlayout.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index a1b21b111b..783a7b083d 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -1707,6 +1707,12 @@ recalc_minmax_widths: if (maxW == QFIXED_MAX) continue; + // for variable columns the maxWidth will later be considered as the + // column width (column width = content width). We must avoid that the + // pixel-alignment rounding step floors this value and thus the text + // rendering later erroneously wraps the content. + maxW = maxW.ceil(); + widthToDistribute = maxW; for (int n = 0; n < cspan; ++n) { const int col = i + n;