diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-26 01:00:11 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-04-09 10:08:41 +0200 |
commit | 2812184e1bb87cd94d2989162bc6ea954bb585c4 (patch) | |
tree | 25460548730e2ddc1f6f328d54e97d3fbfb49d21 /src/quickwidgets | |
parent | cd4a99a7ba92968bf88da9af2624bb738d71e726 (diff) | |
parent | bf205b45a29ba80d94df3b6bac5fec4c7cd79bf9 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/qml/jsruntime/qv4executablecompilationunit.cpp
src/qml/jsruntime/qv4executablecompilationunit_p.h
src/qml/qml/qqmlobjectcreator.cpp
src/qml/qml/qqmlpropertycachecreator_p.h
src/qml/qml/qqmltypecompiler.cpp
src/qml/qml/qqmltypedata.cpp
tests/auto/qml/qmlformat/tst_qmlformat.cpp
tools/qmllint/scopetree.cpp
src/qml/qml/qqmlapplicationengine_p.h
Adjusted tools/qmllint/findunqualified.cpp to use newer API
Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
Diffstat (limited to 'src/quickwidgets')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index db7ae22767..59d4a89fbf 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -109,6 +109,7 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) renderControl = new QQuickWidgetRenderControl(q); offscreenWindow = new QQuickWindow(*new QQuickOffcreenWindowPrivate(),renderControl); offscreenWindow->setTitle(QString::fromLatin1("Offscreen")); + offscreenWindow->setObjectName(QString::fromLatin1("QQuickOffScreenWindow")); // Do not call create() on offscreenWindow. // Check if the Software Adaptation is being used @@ -804,15 +805,29 @@ void QQuickWidgetPrivate::updateSize() q->updateGeometry(); } } else if (resizeMode == QQuickWidget::SizeRootObjectToView) { - 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()); - else if (needToUpdateHeight) - root->setHeight(q->height()); + const bool needToUpdateWidth = !qFuzzyCompare(q->width(), root->width()); + const bool needToUpdateHeight = !qFuzzyCompare(q->height(), root->height()); + + if (needToUpdateWidth && needToUpdateHeight) { + // Make sure that we have realistic sizing behavior by following + // what on-screen windows would do and resize everything, not just + // the root item. We do this because other types may be relying on + // us to behave correctly. + const QSizeF newSize(q->width(), q->height()); + offscreenWindow->resize(newSize.toSize()); + offscreenWindow->contentItem()->setSize(newSize); + root->setSize(newSize); + } else if (needToUpdateWidth) { + const int newWidth = q->width(); + offscreenWindow->setWidth(newWidth); + offscreenWindow->contentItem()->setWidth(newWidth); + root->setWidth(newWidth); + } else if (needToUpdateHeight) { + const int newHeight = q->height(); + offscreenWindow->setHeight(newHeight); + offscreenWindow->contentItem()->setHeight(newHeight); + root->setHeight(newHeight); + } } } |