Fix QTextLine::cursorToX()

0e99f3c broke tst_qquicktextinput::horizontalAlignment_RightToLeft()
and tst_qquicktextedit::hAlign_RightToLeft(). This fix was proposed
by Konstantin.

Change-Id: I602b7301d415f266224ae2c1ffd81244e9565862
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
J-P Nurmi 2015-11-25 11:16:12 +01:00
parent 00db6dbc27
commit d06d7413d5

View File

@ -2627,7 +2627,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
const QScriptLine &line = eng->lines[index];
bool lastLine = index >= eng->lines.size() - 1;
QFixed x = line.x;
QFixed x = line.x + eng->alignLine(line) - eng->leadingSpaceWidth(line);
if (!eng->layoutData)
eng->itemize();
@ -2636,8 +2636,6 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
return x.toReal();
}
x += eng->alignLine(line) - eng->leadingSpaceWidth(line);
int lineEnd = line.from + line.length + line.trailingSpaces;
int pos = qBound(line.from, *cursorPos, lineEnd);
int itm;