From c15fea6691485501547449e5f78725d3b6f1c968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 20 Jun 2016 13:48:12 +0200 Subject: QQuickWidget: Propagate screen changes. This is required to make Qt Quick pick up changes to the devicePixelRatio. Failure to do so prevents a proper update of text nodes, as seen in the Qt Creator welcome screen. Propagate the new screen to the offscreenWindow, offscreenSurface and context. [ChangeLog][QtQuick] QQuickWidget now properly repaints text on high-DPI screen changes. Change-Id: I8f0b9f2f8768f99e293de018ae56d50ddf20b43a Reviewed-by: Laszlo Agocs --- src/quickwidgets/qquickwidget.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 1a840b44bd..6709d88fa3 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1217,6 +1217,17 @@ bool QQuickWidget::event(QEvent *e) break; case QEvent::ScreenChangeInternal: + if (QWindow *window = this->window()->windowHandle()) { + QScreen *newScreen = window->screen(); + + if (d->offscreenWindow) + d->offscreenWindow->setScreen(newScreen); + if (d->offscreenSurface) + d->offscreenSurface->setScreen(newScreen); + if (d->context) + d->context->setScreen(newScreen); + } + if (d->fbo) { // This will check the size taking the devicePixelRatio into account // and recreate if needed. -- cgit v1.2.3 From 5d23470b8d0bacb0e0ba074672f94e526cc9e456 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 1 Jun 2016 11:40:45 +0200 Subject: Report changes correctly when inserting into a ListView Commit v5.6.0-beta1~7 (ListView: Sanitize visibleItems list after model insertions, 2015-12-07) introduced sanitizing of the container of visibleItems, but it did not affect the return value of the QQuickListViewPrivate::applyInsertionChange function. The return value is used in QQuickItemViewPrivate::layout() to determine whether the layouting should proceed, or an early return is possible instead. If the layouting does not proceed, then the newly inserted visible items do not get painted, resulting in the linked bug. The return value of the QQuickListViewPrivate::applyInsertionChange function was previously determined by whether the new count of visible items is greater than the previous count. After the sanitation in commit v5.6.0-beta1~7, this numeric comparison is no longer a good indicator of whether a repaint is needed. Change the return value to indicate whether new items were inserted which are visible in a more-direct way. Verify that visible items are initialized correctly in tests. They should not be 'culled'. It is necessary to invoke the layout method first to clear the forceLayout state. Two pre-existing tests fail before the fix in this patch. Change-Id: I625f1e02bf7001834adb147161a1e478a0ce2a0d Task-number: QTBUG-53263 Reviewed-by: Robin Burchell --- src/quick/items/qquicklistview.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 78a64c5df1..b324e00cac 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -3117,7 +3117,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } } - int prevVisibleCount = visibleItems.count(); + bool visibleAffected = false; if (insertResult->visiblePos.isValid() && pos < insertResult->visiblePos) { // Insert items before the visible item. int insertionIdx = index; @@ -3140,6 +3140,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch if (!item) return false; + visibleAffected = true; visibleItems.insert(insertionIdx, item); if (insertionIdx == 0) insertResult->changedFirstItem = true; @@ -3171,6 +3172,9 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } else { qreal to = buffer + displayMarginEnd + tempPos + size(); + + visibleAffected = count > 0 && pos < to; + for (int i = 0; i < count && pos <= to; ++i) { FxViewItem *item = 0; if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) @@ -3221,7 +3225,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch updateVisibleIndex(); - return visibleItems.count() > prevVisibleCount; + return visibleAffected; } void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) -- cgit v1.2.3 From aa869cbb06bcf005e238059a2cb0205947ff0b5f Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 21 Jun 2016 13:16:41 +0200 Subject: Add missing signal handling for QJSValue Emitting signal with QJSValue argument ends in QVariant converstion in qml bound signal expression evaluation. Create missing handling for arguments of type QJSValue. Change-Id: I3d51a5455c09d0eef1123941066d20ad68f4074d Reviewed-by: Erik Verbruggen Reviewed-by: Lars Knoll --- src/qml/qml/qqmlboundsignal.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 6d8f883e4c..a6fdf60c86 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -48,6 +48,7 @@ #include #include "qqmlinfo.h" +#include #include #include @@ -217,7 +218,9 @@ void QQmlBoundSignalExpression::evaluate(void **a) //### ideally we would use metaTypeToJS, however it currently gives different results // for several cases (such as QVariant type and QObject-derived types) //args[ii] = engine->metaTypeToJS(type, a[ii + 1]); - if (type == QMetaType::QVariant) { + if (type == qMetaTypeId()) { + callData->args[ii] = *QJSValuePrivate::getValue(reinterpret_cast(a[ii + 1])); + } else if (type == QMetaType::QVariant) { callData->args[ii] = scope.engine->fromVariant(*((QVariant *)a[ii + 1])); } else if (type == QMetaType::Int) { //### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise -- cgit v1.2.3 From b61c774ce58d15bfc26a2a75b55e3f5eefbcdcc2 Mon Sep 17 00:00:00 2001 From: Daniel d'Andrada Date: Wed, 8 Jun 2016 14:42:03 -0300 Subject: QQuickSpriteEngine: avoid entering infinite loop in assembledImage() Do not allow a frame size larger than the image size, otherwise we would never leave "while (framesLeft > 0) {...}" as framesLeft is never decremented because "copied/frameWidth" in the expression "framesLeft -= copied/frameWidth;" always resolves to zero because copied < frameWidth. Task-number: QTBUG-53937 Change-Id: Ia777ec65d72562426b13533918efcaca5bcabdd7 Reviewed-by: Albert Astals Cid Reviewed-by: Shawn Rutledge Reviewed-by: Andy Nichols --- src/quick/items/qquickspriteengine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index 243feef683..864f632e7c 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -399,6 +399,15 @@ QImage QQuickSpriteEngine::assembledImage() QImage img = state->m_pix.image(); + { + const QSize frameSize(state->m_frameWidth, state->m_frameHeight); + if (!(img.size() - frameSize).isValid()) { + qmlInfo(state).nospace() << "SpriteEngine: Invalid frame size " << frameSize << "." + " It's bigger than image size " << img.size() << "."; + return QImage(); + } + } + //Check that the frame sizes are the same within one sprite if (!state->m_frameWidth) state->m_frameWidth = img.width() / state->frames(); -- cgit v1.2.3 From b90f810ffa5a7f98b0ac58e5812bcdcd66d028bc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Jun 2016 14:36:55 -0700 Subject: Use QDateTime::currentMSecsSinceEpoch() instead of currentDateTime More efficient if all you want is the number of seconds. Change-Id: Ib57b52598e2f452985e9fffd145a36f2b3c703ea Reviewed-by: Erik Verbruggen --- src/qml/doc/src/cppintegration/definetypes.qdoc | 2 +- src/quick/items/context2d/qquickcanvasitem.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc index 593feb49e7..e06451b2bc 100644 --- a/src/qml/doc/src/cppintegration/definetypes.qdoc +++ b/src/qml/doc/src/cppintegration/definetypes.qdoc @@ -603,7 +603,7 @@ public: RandomNumberGenerator(QObject *parent) : QObject(parent), m_maxValue(100) { - qsrand(QDateTime::currentDateTime().toTime_t()); + qsrand(QDateTime::currentMSecsSinceEpoch() / 1000); QObject::connect(&m_timer, SIGNAL(timeout()), SLOT(updateProperty())); m_timer.start(500); } diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index b3b5144eb3..89a68e4f33 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -711,7 +711,7 @@ void QQuickCanvasItem::updatePolish() for (auto it = animationCallbacks.cbegin(), end = animationCallbacks.cend(); it != end; ++it) { QV4::ScopedFunctionObject f(scope, it.value().value()); - callData->args[0] = QV4::Primitive::fromUInt32(QDateTime::currentDateTimeUtc().toTime_t()); + callData->args[0] = QV4::Primitive::fromUInt32(QDateTime::currentMSecsSinceEpoch() / 1000); f->call(callData); } } -- cgit v1.2.3 From fb15206453faa8db26feb197dac3d16a8d6dfa1b Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 21 Jun 2016 13:40:15 +0200 Subject: ungrab touch points if the MultiPointTouchArea is hidden or disabled This caused MPTA to not emit onCanceled and caused the touch points 'pressed' property to not become 'false' after the MPTA was hidden or disabled. We now ungrab the touch points where we already ungrabbed the mouse. Change-Id: I90a5d4fa4b3fa470b8b60881c80418e79061f001 Task-number: QTBUG-42928 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickitem.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index d0f5f162fc..1c7a556540 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5715,6 +5715,8 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible) QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window); if (windowPriv->mouseGrabberItem == q) q->ungrabMouse(); + if (!effectiveVisible) + q->ungrabTouchPoints(); } bool childVisibilityChanged = false; @@ -5763,6 +5765,8 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window); if (windowPriv->mouseGrabberItem == q) q->ungrabMouse(); + if (!effectiveEnable) + q->ungrabTouchPoints(); if (scope && !effectiveEnable && activeFocus) { windowPriv->clearFocusInScope( scope, q, Qt::OtherFocusReason, QQuickWindowPrivate::DontChangeFocusProperty | QQuickWindowPrivate::DontChangeSubFocusItem); -- cgit v1.2.3 From 6c16a50a51c1bafad71ab48c19ce98d57c005d25 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Jun 2016 09:45:06 +0200 Subject: Rename qt.scenegraph.info to qt.scenegraph.general If configured with logging rules (QT_LOGGING_RULES=), qt.scenegraph.info=true will be interpreted as enabling QtInfoMsg for the qt.scenegraph category and subcategories. [ChangeLog][QtQuick] qt.scenegraph.info logging category got renamed to qt.scenegraph.general. Task-number: QTBUG-54238 Change-Id: I7601e522697c3b4b00b6e9866b803d91f72e76fc Reviewed-by: Gunnar Sletta Reviewed-by: Shawn Rutledge --- src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc | 4 ++-- src/quick/scenegraph/qsgcontext.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc index 516630d034..caedd72dc5 100644 --- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc @@ -180,7 +180,7 @@ dedicated thread. Qt attempts to choose a suitable loop based on the platform and possibly the graphics drivers in use. When this is not satisfactory, or for testing purposes, the environment variable \c QSG_RENDER_LOOP can be used to force the usage of a given loop. To -verify which render loop is in use, enable the \c qt.scenegraph.info +verify which render loop is in use, enable the \c qt.scenegraph.general \l {QLoggingCategory}{logging category}. \note The \c threaded and \c windows render loops rely on the OpenGL @@ -368,7 +368,7 @@ addition to being helpful to Qt contributors. \li \c {qt.scenegraph.time.glyph} - logs the time spent preparing distance field glyphs -\li \c {qt.scenegraph.info} - logs general information about various parts of the scene graph and the graphics stack +\li \c {qt.scenegraph.general} - logs general information about various parts of the scene graph and the graphics stack \li \c {qt.scenegraph.renderloop} - creates a detailed log of the various stages involved in rendering. This log mode is primarily useful for developers working on Qt. diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index dd6977e42e..be228e87c7 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE // Used for very high-level info about the renderering and gl context // Includes GL_VERSION, type of render loop, atlas size, etc. -Q_LOGGING_CATEGORY(QSG_LOG_INFO, "qt.scenegraph.info") +Q_LOGGING_CATEGORY(QSG_LOG_INFO, "qt.scenegraph.general") // Used to debug the renderloop logic. Primarily useful for platform integrators // and when investigating the render loop logic. -- cgit v1.2.3 From a3935184c4dbeda4f46e8140c9f75af1e58189f1 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 10 Jun 2016 15:13:31 +0200 Subject: QQuickWidget: Fix crash when there's an offscreen window, but no real window context Fix crash when creating a QQuickWidget where the offscreenWindow context is valid, but the window shareContext is not. This happens e.g. when QWebEngineWidgets is loaded, that creates a globally shared context. Task-number: QTBUG-54020 Change-Id: Ieeba0c20d12cce220b22cdd76adaf87d1ab2649e Reviewed-by: Joerg Bornemann Reviewed-by: Laszlo Agocs --- src/quickwidgets/qquickwidget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 6709d88fa3..7f869c6ba5 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -778,9 +778,10 @@ void QQuickWidget::createFramebufferObject() return; } - if (context->shareContext() != QWidgetPrivate::get(window())->shareContext()) { - context->setShareContext(QWidgetPrivate::get(window())->shareContext()); - context->setScreen(context->shareContext()->screen()); + QOpenGLContext *shareWindowContext = QWidgetPrivate::get(window())->shareContext(); + if (shareWindowContext && context->shareContext() != shareWindowContext) { + context->setShareContext(shareWindowContext); + context->setScreen(shareWindowContext->screen()); if (!context->create()) qWarning("QQuickWidget: Failed to recreate context"); // The screen may be different so we must recreate the offscreen surface too. -- cgit v1.2.3 From 8d35bf976ea3283ef458dc40d6477013b9064583 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 22 Jun 2016 15:28:20 +0200 Subject: Remove misleading out of date comments in QQuickWindowPrivate Task-number: QTBUG-54133 Change-Id: I68e41c3d6c066745058db0c15984d680d6c05ee9 Reviewed-by: Andy Nichols --- src/quick/items/qquickwindow_p.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 787958ef86..33aa021d98 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -234,8 +234,6 @@ public: uint clearBeforeRendering : 1; - // Currently unused in the default implementation, as we're not stopping - // rendering when obscured as we should... uint persistentGLContext : 1; uint persistentSceneGraph : 1; -- cgit v1.2.3 From c9d4c8ed97694defea78184a80874764ebedfda1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 Jun 2016 10:22:47 +0200 Subject: Create QmlEngine lazy in case one is not needed QQuickWidget may be used with just a root item, and won't need a QmlEngine in that case. So if one isn't given to the constructor, only create one when one is needed for evaluating source. Change-Id: I96cfe5e2473d5d53fc2d52d4646d36c43f4ccb8a Reviewed-by: Laszlo Agocs --- src/quickwidgets/qquickwidget.cpp | 28 ++++++++++++++++------------ src/quickwidgets/qquickwidget_p.h | 1 + 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 2f43582529..05097b3ce2 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -96,10 +96,7 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) engine = e; - if (engine.isNull()) - engine = new QQmlEngine(q); - - if (!engine.data()->incubationController()) + if (!engine.isNull() && !engine.data()->incubationController()) engine.data()->setIncubationController(offscreenWindow->incubationController()); #ifndef QT_NO_DRAGANDDROP @@ -112,6 +109,16 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) QObject::connect(renderControl, SIGNAL(sceneChanged()), q, SLOT(triggerUpdate())); } +void QQuickWidgetPrivate::ensureEngine() +{ + Q_Q(QQuickWidget); + if (!engine.isNull()) + return; + + engine = new QQmlEngine(q); + engine.data()->setIncubationController(offscreenWindow->incubationController()); +} + void QQuickWidgetPrivate::invalidateRenderControl() { if (!context) // this is not an error, could be called before creating the context, or multiple times @@ -167,10 +174,7 @@ QQuickWidgetPrivate::~QQuickWidgetPrivate() void QQuickWidgetPrivate::execute() { Q_Q(QQuickWidget); - if (!engine) { - qWarning() << "QQuickWidget: invalid qml engine."; - return; - } + ensureEngine(); if (root) { delete root; @@ -404,7 +408,6 @@ QQuickWidget::QQuickWidget(QQmlEngine* engine, QWidget *parent) { setMouseTracking(true); setFocusPolicy(Qt::StrongFocus); - Q_ASSERT(engine); d_func()->init(engine); } @@ -548,7 +551,7 @@ QQmlContext* QQuickWidget::rootContext() const QQuickWidget::Status QQuickWidget::status() const { Q_D(const QQuickWidget); - if (!d->engine) + if (!d->engine && !d->source.isEmpty()) return QQuickWidget::Error; if (!d->component) @@ -574,11 +577,12 @@ QList QQuickWidget::errors() const if (d->component) errs = d->component->errors(); - if (!d->engine) { + if (!d->engine && !d->source.isEmpty()) { QQmlError error; error.setDescription(QLatin1String("QQuickWidget: invalid qml engine.")); errs << error; - } else if (d->component && d->component->status() == QQmlComponent::Ready && !d->root) { + } + if (d->component && d->component->status() == QQmlComponent::Ready && !d->root) { QQmlError error; error.setDescription(QLatin1String("QQuickWidget: invalid root object.")); errs << error; diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h index fd3ef8fbbf..f0e1f848e3 100644 --- a/src/quickwidgets/qquickwidget_p.h +++ b/src/quickwidgets/qquickwidget_p.h @@ -105,6 +105,7 @@ public: QImage grabFramebuffer() Q_DECL_OVERRIDE; void init(QQmlEngine* e = 0); + void ensureEngine(); void handleWindowChange(); void invalidateRenderControl(); -- cgit v1.2.3 From 188b160dd0f9959ea01647e07478254e928e3411 Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Thu, 23 Jun 2016 23:17:59 +0800 Subject: Fix QQmlTypeData object leak Don't forget to drop refcount of QQmlTypeData object in QQmlType::resolveCompositeBaseType() to prevent leakage. Change-Id: I079839a3347def1c2ac8f9cc07a52debb885b36e Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlmetatype.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index c5d11ee3c3..337c3bce82 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -484,8 +484,8 @@ QQmlType *QQmlType::resolveCompositeBaseType(QQmlEnginePrivate *engine) const Q_ASSERT(isComposite()); if (!engine) return 0; - QQmlTypeData *td = engine->typeLoader.getType(sourceUrl()); - if (!td || !td->isComplete()) + QQmlRefPointer td(engine->typeLoader.getType(sourceUrl()), QQmlRefPointer::Adopt); + if (td.isNull() || !td->isComplete()) return 0; QQmlCompiledData *cd = td->compiledData(); const QMetaObject *mo = cd->rootPropertyCache->firstCppMetaObject(); -- cgit v1.2.3 From 1b897195a14b63a553b139983736d8dfdd419ffd Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 20 Jun 2016 16:56:52 +0200 Subject: Fix missing QQuickWidget updates Having an animated QQuickFramebufferObject inside a QQuickWidget is currently broken due to losing update requests. The problems are introduced in 4b4cf31c7a4bcb89cabca09102c4e0a22ab0c6b1 where we may erroneously reset the updatePending false even though there may be an active triggerUpdate ticking via the 5 ms update timer. Task-number: QTBUG-54239 Change-Id: If84af8ec9c992761cfef9049de642a943f91cfe6 Reviewed-by: Paul Olav Tvete --- src/quickwidgets/qquickwidget.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 7f869c6ba5..39f7b6c3d3 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1103,7 +1103,14 @@ void QQuickWidget::showEvent(QShowEvent *) d->createContext(); if (d->offscreenWindow->openglContext()) { d->render(true); - if (d->updatePending) { + // render() may have led to a QQuickWindow::update() call (for + // example, having a scene with a QQuickFramebufferObject::Renderer + // calling update() in its render()) which in turn results in + // renderRequested in the rendercontrol, ending up in + // triggerUpdate. In this case just calling update() is not + // acceptable, we need the full renderSceneGraph issued from + // timerEvent(). + if (!d->eventPending && d->updatePending) { d->updatePending = false; update(); } -- cgit v1.2.3 From 97212616d5a7fc68d9ee97015751326ec2908287 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 27 Jun 2016 11:55:33 +0200 Subject: Lazy create QmlEngine on accessing rootContext A common usecase appears to be to set variables in the rootContext before loading a url in a QQuickWidget. We there need to ensure there is a QmlEngine to set variables on when this is attempted. Change-Id: I07aff2104313eeb3fab902ea3c6043c3c82c50f7 Reviewed-by: Laszlo Agocs --- src/quickwidgets/qquickwidget.cpp | 12 +++++++----- src/quickwidgets/qquickwidget_p.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 05097b3ce2..49e7affa31 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -109,13 +109,13 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) QObject::connect(renderControl, SIGNAL(sceneChanged()), q, SLOT(triggerUpdate())); } -void QQuickWidgetPrivate::ensureEngine() +void QQuickWidgetPrivate::ensureEngine() const { - Q_Q(QQuickWidget); + Q_Q(const QQuickWidget); if (!engine.isNull()) return; - engine = new QQmlEngine(q); + engine = new QQmlEngine(const_cast(q)); engine.data()->setIncubationController(offscreenWindow->incubationController()); } @@ -493,7 +493,8 @@ QUrl QQuickWidget::source() const QQmlEngine* QQuickWidget::engine() const { Q_D(const QQuickWidget); - return d->engine ? const_cast(d->engine.data()) : 0; + d->ensureEngine(); + return const_cast(d->engine.data()); } /*! @@ -506,7 +507,8 @@ QQmlEngine* QQuickWidget::engine() const QQmlContext* QQuickWidget::rootContext() const { Q_D(const QQuickWidget); - return d->engine ? d->engine.data()->rootContext() : 0; + d->ensureEngine(); + return d->engine.data()->rootContext(); } /*! diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h index f0e1f848e3..b01d634fcd 100644 --- a/src/quickwidgets/qquickwidget_p.h +++ b/src/quickwidgets/qquickwidget_p.h @@ -105,7 +105,7 @@ public: QImage grabFramebuffer() Q_DECL_OVERRIDE; void init(QQmlEngine* e = 0); - void ensureEngine(); + void ensureEngine() const; void handleWindowChange(); void invalidateRenderControl(); @@ -115,7 +115,7 @@ public: QUrl source; - QPointer engine; + mutable QPointer engine; QQmlComponent *component; QBasicTimer resizetimer; QQuickWindow *offscreenWindow; -- cgit v1.2.3 From c0e4ef9f63d41f96287274b2fc7923dacac29c23 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 28 Jun 2016 14:36:43 +0200 Subject: Doc: corrected link issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Can't link to 'Qt Quick Controls - Basic Layouts Example' Change-Id: I74abd84549a870e800a6c5fb361565a78e8605ee Reviewed-by: Topi Reiniö --- src/quick/doc/src/examples.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc index e69c2f6551..e41b472ee1 100644 --- a/src/quick/doc/src/examples.qdoc +++ b/src/quick/doc/src/examples.qdoc @@ -135,7 +135,7 @@ Creator. \div {class="doc-column"} \b{Layouts and Views} \list - \li \l{Qt Quick Controls - Basic Layouts Example}{Basic Layouts} + \li \l{Qt Quick Layouts - Basic Example} \li \l{Qt Quick Examples - Positioners}{Positioners} \li \l{Qt Quick Examples - Views}{Views} \li \l{Qt Quick Examples - Window and Screen}{Windows and Screen} -- cgit v1.2.3 From d5cb1bf4a9e19a0a4471ba5c935f441463a73414 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 28 Jun 2016 14:12:34 +0200 Subject: Doc: solved link issue snippet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cannot find file to quote from: qml/windowconstraints.qml Change-Id: Ic01061c316d56f1d2d1bf2be394fe9395ce9c79a Reviewed-by: Topi Reiniö Reviewed-by: Martin Smith --- src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc index 1b6e7dc539..20a6d131f5 100644 --- a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc +++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc @@ -84,7 +84,7 @@ stretches horizontally. The azure rectangle can be resized from 50x150 to 300x150, and the plum rectangle can be resized from 100x100 to ∞x100. - \snippet windowconstraints.qml rowlayout + \snippet qml/windowconstraints.qml rowlayout \image rowlayout-minimum.png "RowLayout at its minimum" -- cgit v1.2.3