diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 14:51:40 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 17:24:39 +0200 |
commit | 13374ceb165c44658aa97890c37b206859c9a31c (patch) | |
tree | 562362b196a459ee3449a5a1e60e5216a9dd6984 /src/quickwidgets | |
parent | ae47deba4c943c496412530a8d2a5a688ae12038 (diff) | |
parent | b5d18be5a03406d0aac83856dd41e1525fd14a28 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I2963c1209316fb6755f572969f368970450d7991
Diffstat (limited to 'src/quickwidgets')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 6970553fc6..b16bfee6a6 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -50,7 +50,6 @@ #include <private/qqmldebugconnector_p.h> #include <private/qquickprofiler_p.h> #include <private/qqmldebugserviceinterfaces_p.h> -#include <private/qqmlmemoryprofiler_p.h> #include <QtQml/qqmlengine.h> #include <private/qqmlengine_p.h> @@ -252,7 +251,6 @@ void QQuickWidgetPrivate::execute() component = nullptr; } if (!source.isEmpty()) { - QML_MEMORY_SCOPE_URL(engine.data()->baseUrl().resolved(source)); component = new QQmlComponent(engine.data(), source, q); if (!component->isLoading()) { q->continueExecute(); @@ -1087,14 +1085,14 @@ void QQuickWidgetPrivate::setRootObject(QObject *obj) root = sgItem; sgItem->setParentItem(offscreenWindow->contentItem()); } else if (qobject_cast<QWindow *>(obj)) { - qWarning() << "QQuickWidget does not support using windows as a root item." << endl - << endl - << "If you wish to create your root window from QML, consider using QQmlApplicationEngine instead." << endl; + qWarning() << "QQuickWidget does not support using windows as a root item." << Qt::endl + << Qt::endl + << "If you wish to create your root window from QML, consider using QQmlApplicationEngine instead." << Qt::endl; } else { - qWarning() << "QQuickWidget only supports loading of root objects that derive from QQuickItem." << endl - << endl - << "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << endl - << "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << endl; + qWarning() << "QQuickWidget only supports loading of root objects that derive from QQuickItem." << Qt::endl + << Qt::endl + << "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << Qt::endl + << "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << Qt::endl; delete obj; root = nullptr; } @@ -1314,9 +1312,13 @@ void QQuickWidget::mouseDoubleClickEvent(QMouseEvent *e) void QQuickWidget::showEvent(QShowEvent *) { Q_D(QQuickWidget); + bool shouldTriggerUpdate = true; + if (!d->useSoftwareRenderer) { d->createContext(); + if (d->offscreenWindow->openglContext()) { + shouldTriggerUpdate = false; d->render(true); // render() may have led to a QQuickWindow::update() call (for // example, having a scene with a QQuickFramebufferObject::Renderer @@ -1329,11 +1331,12 @@ void QQuickWidget::showEvent(QShowEvent *) d->updatePending = false; update(); } - } else { - triggerUpdate(); } } + if (shouldTriggerUpdate) + triggerUpdate(); + // note offscreenWindow is "QQuickOffScreenWindow" instance d->offscreenWindow->setVisible(true); if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>()) |