diff options
author | Christian Strømme <christian.stromme@theqtcompany.com> | 2015-03-25 18:02:57 +0100 |
---|---|---|
committer | Christian Stromme <christian.stromme@theqtcompany.com> | 2015-03-31 14:38:27 +0000 |
commit | 461335ca2c59f88720219c5c3e5b1a0eadd3b601 (patch) | |
tree | 60b7f52e6da860559a42a3d0a92cb1fd50745326 | |
parent | 15c8231bdc9414062211a63ca6a06dabf197093f (diff) |
Fix the geometry source in QQuickViewController.
The controller item was using the rect it got from geometryChanged()
and mapped it to scene coordinates, but then in its own coordinate
system. The problem with this is that the rect we get, in
geometryChanged(), is relative to the view-controllers parent and can
therefore carry an offset that will give us the wrong scene coordinates.
The easiest solution is to remove the offset and place the rect at
(0, 0), e.g., by calling clipRect().
Change-Id: I29bf729e82498a2534425dc4c173f055305a1b2d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
-rw-r--r-- | src/webview/qquickviewcontroller.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/webview/qquickviewcontroller.cpp b/src/webview/qquickviewcontroller.cpp index 0bd306a..6f32611 100644 --- a/src/webview/qquickviewcontroller.cpp +++ b/src/webview/qquickviewcontroller.cpp @@ -69,9 +69,8 @@ void QQuickViewController::setView(QNativeViewController *view) void QQuickViewController::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { QQuickItem::geometryChanged(newGeometry, oldGeometry); - if (newGeometry.isValid()) - m_view->setGeometry(mapRectToScene(newGeometry).toRect()); + m_view->setGeometry(mapRectToScene(clipRect()).toRect()); else qWarning() << __FUNCTION__ << "Invalid geometry: " << newGeometry; } |