Make tst_accessibility's characterRect match QAccessibleTextWidget::characterRect

The former didn't account for ascent and descent.

Change-Id: If741f22f7e79ac3c13e58f2966358010d9f9ec81
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-08-04 18:13:25 +02:00
parent 4d572362e8
commit 7c8e95612e

View File

@ -1725,7 +1725,7 @@ static QRect characterRect(const QTextEdit &edit, int offset)
int h = fm.height(); int h = fm.height();
qreal x = line.cursorToX(relativeOffset); qreal x = line.cursorToX(relativeOffset);
QRect r(layoutPosition.x() + x, layoutPosition.y() + line.y(), w, h); QRect r(layoutPosition.x() + x, layoutPosition.y() + line.y() + line.ascent() + fm.descent() - h, w, h);
r.moveTo(edit.viewport()->mapToGlobal(r.topLeft())); r.moveTo(edit.viewport()->mapToGlobal(r.topLeft()));
return r; return r;