Fix qmlscene initial resize for delayed loading
authorMatthew Vogt <matthew.vogt@nokia.com>
Mon, 9 Jul 2012 04:54:18 +0000 (14:54 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 11 Jul 2012 01:00:03 +0000 (03:00 +0200)
When QQuickView acquires a default initial size while waiting for
the source component to be loaded, the resulting width() and height()
are 1 rather than zero.  Fix the check for default size after component
has loaded to account for this disparity.

Change-Id: Ifaf418525e66dcc094c87ac1f9b63d1b05a08fd7
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/quick/items/qquickview.cpp

index 0322caf..52c9959 100644 (file)
@@ -483,8 +483,8 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
     }
     if (root) {
         initialSize = rootObjectSize();
-        if ((resizeMode == QQuickView::SizeViewToRootObject || !q->width() || !q->height())
-                && initialSize != q->size()) {
+        if ((resizeMode == QQuickView::SizeViewToRootObject || q->width() <= 1 || q->height() <= 1) &&
+            initialSize != q->size()) {
             q->resize(initialSize);
         }
         initResize();