Skip to content

Fix specific overflow in qtextlayout [plus 2 non-5.15 cherry-picks]

Alternative to !251 (closed) backporting two conflicting but not-marked-for-5.15 commits.

See also:

[PATCH 1/3] QTextLayout: fix maximumWidth() for a text containing spaces

When laying out a text and calculating maxWidth, we must _always_ take
into account the accumulated width of spaces (lbh.spaceData.textWidth)
regardless of wrapMode, other text content, spaces position, etc.

Fixes: QTBUG-106947
Change-Id: I2ac9af92ed7dd07c1e040bfcf83949a358d1c9c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 4945fd93f13d2fc34adf260fd0e0325d0794f3f7)

[PATCH 2/3] QTextLayout: fix maximumWidth() for a text containing line separator

This is improved version of previous fix
013c346a8dcbd618febb07884c64c740daf9754d that was reverted because it
broke some tests for Quick Text. The problem was that it did not work
correctly in the case the text was wrapped to a fixed width.
To deal with this we'll accumulate current line full width (as if it
hadn't been wrapped) in layout data (layoutData->currentMaxWidth).
Then when the next line is explicitly wrapped by line or paragraph
separator, this accumulated width will be used to adjust layout's
maximum width.

Change-Id: Iad7119d9808e1db15fe1fbc5db049c3db928529f
Fixes: QTBUG-89557
Fixes: QTBUG-104986
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 991c056438b311566bc4ea543af0f33dfd5dffbb)

[PATCH 3/3] Fix specific overflow in qtextlayout

Adds qAddOverflow and qMulOverflow definitions to QFixed

Fixes: QTBUG-113337
Pick-to: 6.5 6.5.1 6.2 5.15
Change-Id: I13579306defceaccdc0fbb1ec0e9b77c6f8d1af9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7b7a01c266b507636eab51a36328c7c72d82d93c)

* asturmlechner 2023-05-18: use add_overflow instead of qAddOverflow
Edited by Andreas Sturmlechner

Merge request reports