From 5b162837d86c38ecea715627aaf448b2eb23728a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 3 Sep 2014 14:55:59 +0200 Subject: QQuickTextInput: keep floating point precition when calculating offset Without this patch, positionToRectangle will return a slightly different rectangle than what ends up being drawn. Change-Id: Ib1a3936f0fab393d6016d85d63547ec7f3036b7a Reviewed-by: Andrew den Exter Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/items/qquicktextinput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index c91b79dd34..e265d04ecc 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1868,9 +1868,9 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData if (d->autoScroll && d->m_textLayout.lineCount() > 0) { QFontMetricsF fm(d->font); // the y offset is there to keep the baseline constant in case we have script changes in the text. - offset = -QPoint(d->hscroll, d->vscroll + d->m_textLayout.lineAt(0).ascent() - fm.ascent()); + offset = -QPointF(d->hscroll, d->vscroll + d->m_textLayout.lineAt(0).ascent() - fm.ascent()); } else { - offset = -QPoint(d->hscroll, d->vscroll); + offset = -QPointF(d->hscroll, d->vscroll); } if (!d->m_textLayout.text().isEmpty() -- cgit v1.2.3