diff options
Diffstat (limited to 'src/quick/items/qquickview.cpp')
-rw-r--r-- | src/quick/items/qquickview.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index 1101b88992..d79d8ba3cd 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -44,9 +44,6 @@ #include "qquickitem_p.h" #include "qquickitemchangelistener_p.h" -#include <private/qqmldebugconnector_p.h> -#include <private/qquickprofiler_p.h> -#include <private/qqmldebugserviceinterfaces_p.h> #include <private/qqmlmemoryprofiler_p.h> #include <QtQml/qqmlengine.h> @@ -131,14 +128,15 @@ void QQuickViewPrivate::execute() } } -void QQuickViewPrivate::itemGeometryChanged(QQuickItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry) +void QQuickViewPrivate::itemGeometryChanged(QQuickItem *resizeItem, QQuickGeometryChange change, + const QRectF &diff) { Q_Q(QQuickView); if (resizeItem == root && resizeMode == QQuickView::SizeViewToRootObject) { // wait for both width and height to be changed resizetimer.start(0,q); } - QQuickItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry); + QQuickItemChangeListener::itemGeometryChanged(resizeItem, change, diff); } /*! @@ -266,8 +264,8 @@ void QQuickView::setContent(const QUrl& url, QQmlComponent *component, QObject* d->component = component; if (d->component && d->component->isError()) { - QList<QQmlError> errorList = d->component->errors(); - foreach (const QQmlError &error, errorList) { + const QList<QQmlError> errorList = d->component->errors(); + for (const QQmlError &error : errorList) { QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() << error; } @@ -432,9 +430,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()); } } @@ -472,8 +475,8 @@ void QQuickView::continueExecute() disconnect(d->component, SIGNAL(statusChanged(QQmlComponent::Status)), this, SLOT(continueExecute())); if (d->component->isError()) { - QList<QQmlError> errorList = d->component->errors(); - foreach (const QQmlError &error, errorList) { + const QList<QQmlError> errorList = d->component->errors(); + for (const QQmlError &error : errorList) { QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() << error; } @@ -484,8 +487,8 @@ void QQuickView::continueExecute() QObject *obj = d->component->create(); if (d->component->isError()) { - QList<QQmlError> errorList = d->component->errors(); - foreach (const QQmlError &error, errorList) { + const QList<QQmlError> errorList = d->component->errors(); + for (const QQmlError &error : errorList) { QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() << error; } |