From 2418a36d0a83c22a12654caa5138a0bc4f84e9f3 Mon Sep 17 00:00:00 2001 From: Alexandr Akulich Date: Thu, 2 Jun 2016 23:59:04 +0500 Subject: Set width and height simultaneously on SizeRootObjectToView On QQuickView/QQuickWidget size update we used set width (with the notify signal emission) and then height (with signal emission again). This way code, relying on width and height would be triggered twice and at the first time with there would be outdated height value. The new code takes care on proper value for both width and height. Change-Id: I6525911c40af0ca6a26ab3e7dac16d32a96d9a27 Reviewed-by: Robin Burchell Reviewed-by: Shawn Rutledge --- src/quick/items/qquickview.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/quick/items/qquickview.cpp') diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index 0ed9167fb2..1d89c8bfc2 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -433,9 +433,14 @@ void QQuickViewPrivate::updateSize() q->resize(newSize); } } else if (resizeMode == QQuickView::SizeRootObjectToView) { - if (!qFuzzyCompare(q->width(), root->width())) + bool needToUpdateWidth = !qFuzzyCompare(q->width(), root->width()); + bool needToUpdateHeight = !qFuzzyCompare(q->height(), root->height()); + + if (needToUpdateWidth && needToUpdateHeight) + root->setSize(QSizeF(q->width(), q->height())); + else if (needToUpdateWidth) root->setWidth(q->width()); - if (!qFuzzyCompare(q->height(), root->height())) + else if (needToUpdateHeight) root->setHeight(q->height()); } } -- cgit v1.2.3