diff options
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 266 |
1 files changed, 221 insertions, 45 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f07136fcd3..48ba0ecc28 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -39,7 +39,6 @@ #include "qquickwindow.h" #include "qquickwindow_p.h" -#include "qquickwindowattached_p.h" #include "qquickitem.h" #include "qquickitem_p.h" @@ -94,6 +93,7 @@ Q_LOGGING_CATEGORY(DBG_TOUCH, "qt.quick.touch") Q_LOGGING_CATEGORY(DBG_TOUCH_TARGET, "qt.quick.touch.target") Q_LOGGING_CATEGORY(DBG_MOUSE, "qt.quick.mouse") Q_LOGGING_CATEGORY(DBG_MOUSE_TARGET, "qt.quick.mouse.target") +Q_LOGGING_CATEGORY(lcTablet, "qt.quick.tablet") Q_LOGGING_CATEGORY(lcWheelTarget, "qt.quick.wheel.target") Q_LOGGING_CATEGORY(lcGestureTarget, "qt.quick.gesture.target") Q_LOGGING_CATEGORY(DBG_HOVER_TRACE, "qt.quick.hover.trace") @@ -430,7 +430,7 @@ void QQuickWindowPrivate::syncSceneGraph() if (renderTargetId && !QQuickRenderControl::renderWindowFor(q)) devicePixelRatio = 1; - context->prepareSync(devicePixelRatio); + context->prepareSync(devicePixelRatio, rhi ? swapchain->currentFrameCommandBuffer() : nullptr); animationController->beforeNodeSync(); @@ -528,7 +528,7 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size, const QSize &surfa renderer->setDeviceRect(rect); renderer->setViewportRect(rect); const bool flipY = rhi ? !rhi->isYUpInNDC() : false; - QSGAbstractRenderer::MatrixTransformFlags matrixFlags = 0; + QSGAbstractRenderer::MatrixTransformFlags matrixFlags; if (flipY) matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY; renderer->setProjectionMatrixToRect(QRectF(QPoint(0, 0), logicalSize), matrixFlags); @@ -561,6 +561,7 @@ QQuickWindowPrivate::QQuickWindowPrivate() , activeFocusItem(nullptr) #if QT_CONFIG(cursor) , cursorItem(nullptr) + , cursorHandler(nullptr) #endif #if QT_CONFIG(quick_draganddrop) , dragGrabber(nullptr) @@ -682,10 +683,13 @@ void QQuickWindow::handleApplicationStateChanged(Qt::ApplicationState state) QQmlListProperty<QObject> QQuickWindowPrivate::data() { - return QQmlListProperty<QObject>(q_func(), nullptr, QQuickWindowPrivate::data_append, - QQuickWindowPrivate::data_count, - QQuickWindowPrivate::data_at, - QQuickWindowPrivate::data_clear); + return QQmlListProperty<QObject>(q_func(), nullptr, + QQuickWindowPrivate::data_append, + QQuickWindowPrivate::data_count, + QQuickWindowPrivate::data_at, + QQuickWindowPrivate::data_clear, + QQuickWindowPrivate::data_replace, + QQuickWindowPrivate::data_removeLast); } static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::TouchPoint &p, QTouchEvent *event, QQuickItem *item, bool transformNeeded = true) @@ -771,7 +775,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve if (!item->contains(pos)) break; - qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << hex << p.id() << "->" << item; + qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << Qt::hex << p.id() << "->" << item; QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event.data(), item, false)); // Send a single press and see if that's accepted @@ -813,7 +817,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve QCoreApplication::sendEvent(item, me.data()); event->setAccepted(me->isAccepted()); if (me->isAccepted()) { - qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << hex << p.id() << "->" << mouseGrabberItem; + qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << Qt::hex << p.id() << "->" << mouseGrabberItem; } return event->isAccepted(); } else { @@ -969,8 +973,7 @@ void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent) QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); for (int i = 0; i < touchPoints.count(); ++i) { QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; - - touchPoint.setSceneRect(touchPoint.rect()); + touchPoint.setScenePos(touchPoint.pos()); touchPoint.setStartScenePos(touchPoint.startPos()); touchPoint.setLastScenePos(touchPoint.lastPos()); } @@ -1763,12 +1766,18 @@ bool QQuickWindow::event(QEvent *e) if (d->activeFocusItem) QCoreApplication::sendEvent(d->activeFocusItem, e); return true; + case QEvent::LanguageChange: + if (d->contentItem) + QCoreApplication::sendEvent(d->contentItem, e); + break; default: break; } if (e->type() == QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)) update(); + else if (e->type() == QEvent::Type(QQuickWindowPrivate::TriggerContextCreationFailure)) + d->windowManager->handleContextCreationFailure(this); return QWindow::event(e); } @@ -2117,6 +2126,17 @@ void QQuickWindow::wheelEvent(QWheelEvent *event) } #endif // wheelevent +#if QT_CONFIG(tabletevent) +/*! \reimp */ +void QQuickWindow::tabletEvent(QTabletEvent *event) +{ + Q_D(QQuickWindow); + qCDebug(lcTablet) << event; + // TODO Qt 6: make sure TabletEnterProximity and TabletLeaveProximity are delivered here + d->deliverPointerEvent(d->pointerEventInstance(event)); +} +#endif // tabletevent + bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event) { qCDebug(DBG_TOUCH) << event; @@ -2395,8 +2415,14 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic #endif ev = new QQuickPointerTouchEvent(q, device); break; +#if QT_CONFIG(tabletevent) + case QQuickPointerDevice::Stylus: + case QQuickPointerDevice::Airbrush: + case QQuickPointerDevice::Puck: + ev = new QQuickPointerTabletEvent(q, device); + break; +#endif default: - // TODO tablet event types break; } pointerEventInstances << ev; @@ -2427,7 +2453,15 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event) con case QEvent::TouchCancel: dev = QQuickPointerDevice::touchDevice(static_cast<QTouchEvent *>(event)->device()); break; - // TODO tablet event types +#if QT_CONFIG(tabletevent) + case QEvent::TabletPress: + case QEvent::TabletMove: + case QEvent::TabletRelease: + case QEvent::TabletEnterProximity: + case QEvent::TabletLeaveProximity: + dev = QQuickPointerDevice::tabletDevice(static_cast<QTabletEvent *>(event)); + break; +#endif #if QT_CONFIG(gestures) case QEvent::NativeGesture: dev = QQuickPointerDevice::touchDevice(static_cast<QNativeGestureEvent *>(event)->device()); @@ -2462,6 +2496,11 @@ void QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *event) deliverTouchEvent(event->asPointerTouchEvent()); } else { deliverSinglePointEventUntilAccepted(event); + // If any handler got interested in the tablet event, we don't want to receive a synth-mouse event from QtGui + // TODO Qt 6: QTabletEvent will be accepted by default, like other events + if (event->asPointerTabletEvent() && + (!event->point(0)->passiveGrabbers().isEmpty() || event->point(0)->exclusiveGrabber())) + event->setAccepted(true); } event->reset(nullptr); @@ -2551,7 +2590,7 @@ void QQuickWindowPrivate::deliverTouchEvent(QQuickPointerTouchEvent *event) QQuickEventPoint *point = event->point(i); if (point->state() == QQuickEventPoint::Released) { int id = point->pointId(); - qCDebug(DBG_TOUCH_TARGET) << "TP" << hex << id << "released"; + qCDebug(DBG_TOUCH_TARGET) << "TP" << Qt::hex << id << "released"; point->setGrabberItem(nullptr); if (id == touchMouseId) cancelTouchMouseSynthesis(); @@ -2648,7 +2687,7 @@ bool QQuickWindowPrivate::deliverPressOrReleaseEvent(QQuickPointerEvent *event, if (point->grabberPointerHandler()) cancelTouchMouseSynthesis(); } else { - qCWarning(DBG_TOUCH_TARGET) << "during delivery of touch press, synth-mouse ID" << hex << touchMouseId << "is missing from" << event; + qCWarning(DBG_TOUCH_TARGET) << "during delivery of touch press, synth-mouse ID" << Qt::hex << touchMouseId << "is missing from" << event; } } for (int i = 0; i < pointCount; ++i) { @@ -2790,7 +2829,7 @@ void QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo if (point.state() == Qt::TouchPointPressed) { if (auto *tp = ptEvent->pointById(point.id())) { if (tp->exclusiveGrabber() == item) { - qCDebug(DBG_TOUCH_TARGET) << "TP" << hex << point.id() << "disassociated"; + qCDebug(DBG_TOUCH_TARGET) << "TP" << Qt::hex << point.id() << "disassociated"; tp->setGrabberItem(nullptr); } } @@ -2966,26 +3005,27 @@ void QQuickWindowPrivate::updateCursor(const QPointF &scenePos) { Q_Q(QQuickWindow); - QQuickItem *oldCursorItem = cursorItem; - cursorItem = findCursorItem(contentItem, scenePos); + auto cursorItemAndHandler = findCursorItemAndHandler(contentItem, scenePos); - if (cursorItem != oldCursorItem) { + if (cursorItem != cursorItemAndHandler.first || cursorHandler != cursorItemAndHandler.second) { QWindow *renderWindow = QQuickRenderControl::renderWindowFor(q); QWindow *window = renderWindow ? renderWindow : q; + cursorItem = cursorItemAndHandler.first; + cursorHandler = cursorItemAndHandler.second; if (cursorItem) - window->setCursor(cursorItem->cursor()); + window->setCursor(QQuickItemPrivate::get(cursorItem)->effectiveCursor(cursorHandler)); else window->unsetCursor(); } } -QQuickItem *QQuickWindowPrivate::findCursorItem(QQuickItem *item, const QPointF &scenePos) +QPair<QQuickItem*, QQuickPointerHandler*> QQuickWindowPrivate::findCursorItemAndHandler(QQuickItem *item, const QPointF &scenePos) const { QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) { QPointF p = item->mapFromScene(scenePos); if (!item->contains(p)) - return nullptr; + return {nullptr, nullptr}; } if (itemPrivate->subtreeCursorEnabled) { @@ -2994,17 +3034,24 @@ QQuickItem *QQuickWindowPrivate::findCursorItem(QQuickItem *item, const QPointF QQuickItem *child = children.at(ii); if (!child->isVisible() || !child->isEnabled() || QQuickItemPrivate::get(child)->culled) continue; - if (QQuickItem *cursorItem = findCursorItem(child, scenePos)) - return cursorItem; + auto ret = findCursorItemAndHandler(child, scenePos); + if (ret.first) + return ret; + } + if (itemPrivate->hasCursor || itemPrivate->hasCursorHandler) { + QPointF p = item->mapFromScene(scenePos); + if (!item->contains(p)) + return {nullptr, nullptr}; + if (itemPrivate->hasCursorHandler) { + if (auto handler = itemPrivate->effectiveCursorHandler()) + return {item, handler}; + } + if (itemPrivate->hasCursor) + return {item, nullptr}; } } - if (itemPrivate->hasCursor) { - QPointF p = item->mapFromScene(scenePos); - if (item->contains(p)) - return item; - } - return nullptr; + return {nullptr, nullptr}; } #endif @@ -3106,7 +3153,7 @@ bool QQuickWindowPrivate::sendFilteredPointerEventImpl(QQuickPointerEvent *event qCDebug(DBG_TOUCH) << "touch event intercepted as synth mouse event by childMouseEventFilter of " << filteringParent; skipDelivery.append(filteringParent); if (t != QEvent::MouseButtonRelease) { - qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << hex << tp.id() << "->" << filteringParent; + qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << Qt::hex << tp.id() << "->" << filteringParent; pointerEventInstance(dev)->pointById(tp.id())->setGrabberItem(filteringParent); touchMouseUnset = false; // We want to leave touchMouseId and touchMouseDevice set if (mouseEvent->isAccepted()) @@ -3169,6 +3216,18 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent return overThreshold; } +bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, const QTouchEvent::TouchPoint *tp, int startDragThreshold) +{ + QStyleHints *styleHints = qApp->styleHints(); + bool overThreshold = qAbs(d) > (startDragThreshold >= 0 ? startDragThreshold : styleHints->startDragDistance()); + const bool dragVelocityLimitAvailable = (styleHints->startDragVelocity() > 0); + if (!overThreshold && dragVelocityLimitAvailable) { + qreal velocity = axis == Qt::XAxis ? tp->velocity().x() : tp->velocity().y(); + overThreshold |= qAbs(velocity) > styleHints->startDragVelocity(); + } + return overThreshold; +} + bool QQuickWindowPrivate::dragOverThreshold(QVector2D delta) { int threshold = qApp->styleHints()->startDragDistance(); @@ -3235,6 +3294,20 @@ void QQuickWindowPrivate::data_clear(QQmlListProperty<QObject> *property) itemProperty.clear(&itemProperty); } +void QQuickWindowPrivate::data_replace(QQmlListProperty<QObject> *property, int i, QObject *o) +{ + QQuickWindow *win = static_cast<QQuickWindow*>(property->object); + QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data(); + itemProperty.replace(&itemProperty, i, o); +} + +void QQuickWindowPrivate::data_removeLast(QQmlListProperty<QObject> *property) +{ + QQuickWindow *win = static_cast<QQuickWindow*>(property->object); + QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data(); + itemProperty.removeLast(&itemProperty); +} + bool QQuickWindowPrivate::isRenderable() const { Q_Q(const QQuickWindow); @@ -3243,10 +3316,9 @@ bool QQuickWindowPrivate::isRenderable() const void QQuickWindowPrivate::contextCreationFailureMessage(const QSurfaceFormat &format, QString *translatedMessage, - QString *untranslatedMessage, - bool isEs) + QString *untranslatedMessage) { - const QString contextType = QLatin1String(isEs ? "EGL" : "OpenGL"); + const QString contextType = QLatin1String("OpenGL"); QString formatStr; QDebug(&formatStr) << format; #if defined(Q_OS_WIN32) @@ -3271,6 +3343,16 @@ void QQuickWindowPrivate::contextCreationFailureMessage(const QSurfaceFormat &fo #endif // !Q_OS_WIN32 } +void QQuickWindowPrivate::rhiCreationFailureMessage(const QString &backendName, + QString *translatedMessage, + QString *untranslatedMessage) +{ + const char msg[] = QT_TRANSLATE_NOOP("QQuickWindow", + "Failed to initialize graphics backend for %1."); + *translatedMessage = QQuickWindow::tr(msg).arg(backendName); + *untranslatedMessage = QString::fromLatin1(msg).arg(backendName); +} + #if QT_DEPRECATED_SINCE(5, 8) // ### Qt6: remove @@ -3786,6 +3868,13 @@ bool QQuickWindow::isSceneGraphInitialized() const This signal will be emitted from the scene graph rendering thread. */ +/*! + \qmlsignal QtQuick.Window::Window::frameSwapped() + + This signal is emitted when a frame has been queued for presenting. With + vertical synchronization enabled the signal is emitted at most once per + vsync interval in a continuously animating scene. + */ /*! \fn void QQuickWindow::sceneGraphInitialized() @@ -3793,9 +3882,12 @@ bool QQuickWindow::isSceneGraphInitialized() const This signal is emitted when the scene graph has been initialized. This signal will be emitted from the scene graph rendering thread. - */ +/*! + \qmlsignal QtQuick.Window::Window::sceneGraphInitialized() + \internal + */ /*! \fn void QQuickWindow::sceneGraphInvalidated() @@ -3815,6 +3907,11 @@ bool QQuickWindow::isSceneGraphInitialized() const */ /*! + \qmlsignal QtQuick.Window::Window::sceneGraphInvalidated() + \internal + */ + +/*! \fn void QQuickWindow::sceneGraphError(SceneGraphError error, const QString &message) This signal is emitted when an \a error occurred during scene graph initialization. @@ -3830,6 +3927,19 @@ bool QQuickWindow::isSceneGraphInitialized() const */ /*! + \qmlsignal QtQuick.Window::Window::sceneGraphError(SceneGraphError error, QString message) + + This signal is emitted when an \a error occurred during scene graph initialization. + + You can implement onSceneGraphError(error, message) to handle errors, + such as graphics context creation failures, in a custom way. + If no handler is connected to this signal, Quick will print the \a message, + or show a message box, and terminate the application. + + \since 5.3 + */ + +/*! \class QQuickCloseEvent \internal \since 5.1 @@ -3884,8 +3994,6 @@ bool QQuickWindow::isSceneGraphInitialized() const property is true by default so that the window is allowed to close; but you can implement an \c onClosing handler and set \c {close.accepted = false} if you need to do something else before the window can be closed. - - The corresponding handler is \c onClosing. */ #if QT_CONFIG(opengl) @@ -4176,6 +4284,11 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::beforeSynchronizing() + \internal +*/ + +/*! \fn void QQuickWindow::afterSynchronizing() This signal is emitted after the scene graph is synchronized with the QML state. @@ -4199,6 +4312,12 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::afterSynchronizing() + \internal + \since 5.3 + */ + +/*! \fn void QQuickWindow::beforeRendering() This signal is emitted before the scene starts rendering. @@ -4234,6 +4353,11 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::beforeRendering() + \internal +*/ + +/*! \fn void QQuickWindow::afterRendering() This signal is emitted after the scene has completed rendering, before swapbuffers is called. @@ -4267,6 +4391,11 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::afterRendering() + \internal + */ + +/*! \fn void QQuickWindow::beforeRenderPassRecording() This signal is emitted before the scenegraph starts recording commands for @@ -4299,6 +4428,12 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::beforeRenderPassRecording() + \internal + \since 5.14 +*/ + +/*! \fn void QQuickWindow::afterRenderPassRecording() This signal is emitted after the scenegraph has recorded the commands for @@ -4330,6 +4465,12 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::afterRenderPassRecording() + \internal + \since 5.14 +*/ + +/*! \fn void QQuickWindow::afterAnimating() This signal is emitted on the gui thread before requesting the render thread to @@ -4344,6 +4485,17 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::afterAnimating() + + This signal is emitted on the gui thread before requesting the render thread to + perform the synchronization of the scene graph. + + You can implement onAfterAnimating to do additional processing after each animation step. + + \since 5.3 + */ + +/*! \fn void QQuickWindow::openglContextCreated(QOpenGLContext *context) This signal is emitted on the gui thread when the OpenGL \a context @@ -4355,7 +4507,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const OpenGL context is actually created. QQuickWindow::openglContext() will still return 0 for this window - until after the QQuickWindow::sceneGraphInitialize() has been + until after the QQuickWindow::sceneGraphInitialized() has been emitted. \note @@ -4366,6 +4518,12 @@ QQmlIncubationController *QQuickWindow::incubationController() const */ /*! + \qmlsignal QtQuick.Window::Window::openglContextCreated() + \internal + \since 5.3 + */ + +/*! \fn void QQuickWindow::sceneGraphAboutToStop() This signal is emitted on the render thread when the scene graph is @@ -4388,6 +4546,11 @@ QQmlIncubationController *QQuickWindow::incubationController() const \since 5.3 */ +/*! + \qmlsignal QtQuick.Window::Window::sceneGraphAboutToStop() + \internal + \since 5.3 + */ /*! Sets whether the scene graph rendering of QML should clear the color buffer @@ -4433,7 +4596,7 @@ bool QQuickWindow::clearBeforeRendering() const QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const { - return createTextureFromImage(image, nullptr); + return createTextureFromImage(image, {}); } @@ -4491,7 +4654,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText } - +#if QT_DEPRECATED_SINCE(5, 15) /*! Creates a new QSGTexture object from an existing OpenGL texture \a id and \a size. @@ -4513,6 +4676,8 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText \note This function has no effect when running on the RHI graphics abstraction. Use createTextureFromNativeObject() instead. + \obsolete + \sa sceneGraphInitialized(), QSGTexture */ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const @@ -4539,6 +4704,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create #endif return nullptr; } +#endif /*! \enum QQuickWindow::NativeObjectType @@ -4592,7 +4758,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create \a nativeLayout is only used for APIs like Vulkan. When applicable, it must specify the current image layout, such as, a VkImageLayout value. - \sa sceneGraphInitialized(), QSGTexture + \sa sceneGraphInitialized(), QSGTexture, QSGTexture::nativeTexture() \since 5.14 */ @@ -4723,9 +4889,13 @@ void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha) \note This function only has an effect when using the default OpenGL scene graph adaptation. + \note This function will only reset the OpenGL context in relation to what has been changed + internally as part of the OpenGL scene graph. It does not reset anything that has been changed + externally such as direct OpenGL calls done inside the application code if those same calls are + not used internally. + \note This function has no effect when running on the RHI graphics - abstraction. With the RHI, the functions to call when enqueuing native - graphics commands are beginExternalCommands() and endExternalCommands(). + abstraction and the underlying RHI backend is not OpenGL. \sa QQuickWindow::beforeRendering(), beginExternalCommands(), endExternalCommands() */ @@ -4733,7 +4903,7 @@ void QQuickWindow::resetOpenGLState() { Q_D(QQuickWindow); - if (d->rhi || !openglContext()) + if (!openglContext()) return; QOpenGLContext *ctx = openglContext(); @@ -4848,7 +5018,13 @@ const QQuickWindow::GraphicsStateInfo &QQuickWindow::graphicsStateInfo() directly and the RHI graphics abstraction layer is not in use. Refer to resetOpenGLState() in that case. - \sa endExternalCommands() + \note When the scenegraph is using the RHI graphics abstraction layer with + the OpenGL backend underneath, pay attention to the fact that the OpenGL + state in the context can have arbitrary settings, and this function does not + perform any resetting of the state back to defaults. Call + resetOpenGLState() if that is seen necessary. + + \sa endExternalCommands(), resetOpenGLState() \since 5.14 */ |