Fix QWindow::setFramePosition() to keep the size.

Change-Id: I14551e0d0573c2e8d86d76eadab4df9f3c8ed5e4
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
bb10
Friedemann Kleint 2013-02-08 17:26:47 +01:00 committed by The Qt Project
parent c927d6b9e1
commit d180560e14
2 changed files with 6 additions and 2 deletions

View File

@ -1186,7 +1186,7 @@ void QWindow::setFramePosition(const QPoint &point)
if (d->platformWindow) {
d->platformWindow->setGeometry(QRect(point, size()));
} else {
d->geometry.setTopLeft(point);
d->geometry.moveTopLeft(point);
}
}

View File

@ -173,9 +173,13 @@ void tst_QWindow::positioning()
// Some platforms enforce minimum widths for windows, which can cause extra resize
// events, so set the width to suitably large value to avoid those.
QRect geometry(80, 80, 300, 40);
const QSize size = QSize(300, 40);
const QRect geometry(QPoint(80, 80), size);
Window window;
window.setGeometry(QRect(QPoint(20, 20), size));
window.setFramePosition(QPoint(40, 40)); // Move window around before show, size must not change.
QCOMPARE(window.geometry().size(), size);
window.setGeometry(geometry);
QCOMPARE(window.geometry(), geometry);
window.show();