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:
parent
4d572362e8
commit
7c8e95612e
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user