diff options
author | Volker Hilsheimer <[email protected]> | 2021-11-24 19:14:26 +0100 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2021-12-01 21:23:05 +0100 |
commit | 9538c7ca73e75ab8219e43b36b49200f27164dbb (patch) | |
tree | 138e8428407e8ad1baf057c47cbe05d0d974b32b /src/gui/text/qtextdocumentlayout.cpp | |
parent | 147093edd9c8c1bd2a9fdda76c40f5aba378222b (diff) |
Don't shrink a column when it spans multiple columns
If a cell spans multiple columns, then the merged cells' starting
column's maximum width should never become smaller than what was
calculated from previous rows.
Otherwise, we'd distribute the space of the column that has a span
across all merged columns, resulting in unnecessary line breaks esp if
WrapAnywhere is enabled.
Add a test case.
Fixes: QTBUG-91691
Fixes: QTBUG-95240
Pick-to: 6.2 5.15
Change-Id: Ic27dbdb128071e50fba049de85c9f23ba2f059b3
Reviewed-by: Eirik Aavitsland <[email protected]>
Diffstat (limited to 'src/gui/text/qtextdocumentlayout.cpp')
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 77361d46081..699d8e5fd3c 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2545,6 +2545,8 @@ recalc_minmax_widths: for (int n = 0; n < cspan; ++n) { const int col = i + n; QFixed w = widthToDistribute / (cspan - n); + if (td->maxWidths[col] != QFIXED_MAX) + w = qMax(td->maxWidths[col], w); td->maxWidths[col] = qMax(td->minWidths.at(col), w); widthToDistribute -= td->maxWidths.at(col); if (widthToDistribute <= 0) |