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:
parent
cfd069181c
commit
88932d4339
@ -354,8 +354,8 @@ static QRect inputItemRectangle()
|
||||
? QHighDpiScaling::factor(window)
|
||||
: QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
|
||||
if (pixelDensity != 1.0) {
|
||||
rect.setX(rect.x() * pixelDensity);
|
||||
rect.setY(rect.y() * pixelDensity);
|
||||
rect.moveLeft(rect.x() * pixelDensity);
|
||||
rect.moveTop(rect.y() * pixelDensity);
|
||||
rect.setWidth(rect.width() * pixelDensity);
|
||||
rect.setHeight(rect.height() * pixelDensity);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user