Fix cursorToX for right to left text with trailing whitespace.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Wed, 9 May 2012 06:14:34 +0000 (16:14 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 17 May 2012 02:47:32 +0000 (04:47 +0200)
commitd07982b104de5dc2b54bef09c071500ce22cf539
treef72110e14aabe4b21adf6298f0fc2f630ccaa4c1
parent438787b0ca18b08993bfa640ddf0ad5e6d2340e8
Fix cursorToX for right to left text with trailing whitespace.

QTextLine::cursorToX returned the line width for cursor positions
outside the width of a wrapped right to left line because the
leading space width was always calculated as 0.

Returning a non-zero width for the leading space does cause
problems for other uses of QTextEngine::alignLine() though
as the textAdvance already doesn't include the leading/trailing
space so subtracting it there double accounts for it.

Task-number: QTBUG-24801

Change-Id: I56cbb139814c32813bebb49de8c045b29154a958
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
src/gui/text/qtextengine.cpp
src/gui/text/qtextlayout.cpp
tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp