Android: transform input rectangle correctly

QRect::setX/setY will change both position and size. In this case,
the width and/or height of the input rectangle could end up
negative. The correct functions to use are moveLeft/moveTop which
will preserve the size when changing the position.

Task-number: QTBUG-58179
Change-Id: I71a2e38958754dc53e062ad1c780e2337f72ec32
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Paul Olav Tvete 2017-01-18 13:31:06 +01:00 committed by Jani Heikkinen
parent cfd069181c
commit 88932d4339

View File

@ -354,8 +354,8 @@ static QRect inputItemRectangle()
? QHighDpiScaling::factor(window) ? QHighDpiScaling::factor(window)
: QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
if (pixelDensity != 1.0) { if (pixelDensity != 1.0) {
rect.setX(rect.x() * pixelDensity); rect.moveLeft(rect.x() * pixelDensity);
rect.setY(rect.y() * pixelDensity); rect.moveTop(rect.y() * pixelDensity);
rect.setWidth(rect.width() * pixelDensity); rect.setWidth(rect.width() * pixelDensity);
rect.setHeight(rect.height() * pixelDensity); rect.setHeight(rect.height() * pixelDensity);
} }