diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 4 | ||||
-rw-r--r-- | src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc | 4 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickspriteengine.cpp | 9 | ||||
-rw-r--r-- | src/quick/items/qquickwindow_p.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 2 | ||||
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 27 |
9 files changed, 51 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index dc215ba8a5..c6a7cde240 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -54,6 +54,7 @@ #include <private/qqmlcompiler_p.h> #include "qqmlinfo.h" +#include <private/qjsvalue_p.h> #include <private/qv4value_p.h> #include <private/qv4qobjectwrapper_p.h> @@ -224,7 +225,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<QJSValue>()) { + callData->args[ii] = *QJSValuePrivate::getValue(reinterpret_cast<QJSValue *>(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 diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 576478b729..7b129e2b57 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -490,8 +490,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<QQmlTypeData> td(engine->typeLoader.getType(sourceUrl()), QQmlRefPointer<QQmlTypeData>::Adopt); + if (td.isNull() || !td->isComplete()) return 0; QQmlCompiledData *cd = td->compiledData(); const QMetaObject *mo = cd->rootPropertyCache->firstCppMetaObject(); 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/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 0ff04ce71c..5676bdb13a 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5762,6 +5762,8 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible) QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window); if (windowPriv->mouseGrabberItem == q) q->ungrabMouse(); + if (!effectiveVisible) + q->ungrabTouchPoints(); } bool childVisibilityChanged = false; @@ -5810,6 +5812,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); diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 074af7ebdc..4b9b7df98a 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -3147,7 +3147,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; @@ -3170,6 +3170,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch if (!item) return false; + visibleAffected = true; visibleItems.insert(insertionIdx, item); if (insertionIdx == 0) insertResult->changedFirstItem = true; @@ -3201,6 +3202,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)))) @@ -3251,7 +3255,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) diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index 60d5e3f6dd..df044988e0 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -405,6 +405,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(); diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 1064be7178..9a768ab7dd 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -240,8 +240,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; diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 6572ceb2ce..25945ad78a 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -92,7 +92,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. diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 49e7affa31..b0838e5dc4 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -782,9 +782,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. @@ -1112,7 +1113,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(); } @@ -1234,6 +1242,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. |