From 086317d72a6b6964bf26df4ebedcb6d321b2d56b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 23 Mar 2016 14:48:09 +0100 Subject: QTextEdit::inputMethodQuery(): Preserve types when applying offset. The old code converted QRectF into QRect when applying the offset. Change the offset point to QPointF and change the conversions accordingly. Add an autotest similar to that of QPlainTextEdit. This minimizes rounding errors and prevents conversions since the input method logic mostly uses qreal. Task-number: QTBUG-51923 Change-Id: I0c2f80ccae028d8bbbb97ec603f8782f69959c76 Reviewed-by: Marc Mutz --- src/widgets/widgets/qtextedit.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/widgets/qtextedit.cpp') diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 7439005b92..95f0bc7c59 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1726,15 +1726,15 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argume break; default: v = d->control->inputMethodQuery(query, argument); - const QPoint offset(-d->horizontalOffset(), -d->verticalOffset()); + const QPointF offset(-d->horizontalOffset(), -d->verticalOffset()); if (v.type() == QVariant::RectF) - v = v.toRectF().toRect().translated(offset); + v = v.toRectF().translated(offset); else if (v.type() == QVariant::PointF) - v = v.toPointF().toPoint() + offset; + v = v.toPointF() + offset; else if (v.type() == QVariant::Rect) - v = v.toRect().translated(offset); + v = v.toRect().translated(offset.toPoint()); else if (v.type() == QVariant::Point) - v = v.toPoint() + offset; + v = v.toPoint() + offset.toPoint(); } return v; -- cgit v1.2.3