525void QQuickWindowPrivate::syncSceneGraph()
529 const bool wasRtDirty = redirect.renderTargetDirty;
530 ensureCustomRenderTarget();
532 QRhiCommandBuffer *cb =
nullptr;
534 if (redirect.commandBuffer)
535 cb = redirect.commandBuffer;
537 cb = swapchain->currentFrameCommandBuffer();
539 context->prepareSync(q->effectiveDevicePixelRatio(), cb, graphicsConfig);
541 animationController->beforeNodeSync();
543 emit q->beforeSynchronizing();
544 runAndClearJobs(&beforeSynchronizingJobs);
546 if (pendingFontUpdate) {
548 invalidateFontData(contentItem);
549 context->invalidateGlyphCaches();
552 if (Q_UNLIKELY(!renderer)) {
553 forceUpdate(contentItem);
555 QSGRootNode *rootNode =
new QSGRootNode;
556 rootNode->appendChildNode(QQuickItemPrivate::get(contentItem)->itemNode());
557 const bool useDepth = graphicsConfig.isDepthBufferEnabledFor2D();
558 const QSGRendererInterface::RenderMode renderMode = useDepth ? QSGRendererInterface::RenderMode2D
559 : QSGRendererInterface::RenderMode2DNoDepthBuffer;
560 renderer = context->createRenderer(renderMode);
561 renderer->setRootNode(rootNode);
562 }
else if (Q_UNLIKELY(wasRtDirty)
563 && q->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) {
564 auto softwareRenderer =
static_cast<QSGSoftwareRenderer *>(renderer);
565 softwareRenderer->markDirty();
570 animationController->afterNodeSync();
572 renderer->setClearColor(clearColor);
574 renderer->setVisualizationMode(visualizationMode);
576 if (pendingFontUpdate) {
577 context->flushGlyphCaches();
578 pendingFontUpdate =
false;
581 emit q->afterSynchronizing();
582 runAndClearJobs(&afterSynchronizingJobs);
621void QQuickWindowPrivate::renderSceneGraph()
627 ensureCustomRenderTarget();
629 QSGRenderTarget sgRenderTarget;
631 QRhiRenderTarget *rt;
632 QRhiRenderPassDescriptor *rp;
633 QRhiCommandBuffer *cb;
634 if (redirect.rt.rt.renderTarget) {
635 rt = redirect.rt.rt.renderTarget;
636 rp = rt->renderPassDescriptor();
638 qWarning(
"Custom render target is set but no renderpass descriptor has been provided.");
641 cb = redirect.commandBuffer;
643 qWarning(
"Custom render target is set but no command buffer has been provided.");
648 qWarning(
"QQuickWindow: No render target (neither swapchain nor custom target was provided)");
651 rt = swapchain->currentFrameRenderTarget();
652 rp = rpDescForSwapchain;
653 cb = swapchain->currentFrameCommandBuffer();
655 sgRenderTarget = QSGRenderTarget(rt, rp, cb);
656 sgRenderTarget.multiViewCount = multiViewCount();
658 sgRenderTarget = QSGRenderTarget(redirect.rt.sw.paintDevice);
661 context->beginNextFrame(renderer,
663 emitBeforeRenderPassRecording,
664 emitAfterRenderPassRecording,
667 animationController->advance();
668 emit q->beforeRendering();
669 runAndClearJobs(&beforeRenderingJobs);
671 const qreal devicePixelRatio = q->effectiveDevicePixelRatio();
673 if (redirect.rt.rt.renderTarget)
674 pixelSize = redirect.rt.rt.renderTarget->pixelSize();
675 else if (redirect.rt.sw.paintDevice)
676 pixelSize = QSize(redirect.rt.sw.paintDevice->width(), redirect.rt.sw.paintDevice->height());
678 pixelSize = swapchain->currentPixelSize();
680 pixelSize = q->size() * devicePixelRatio;
682 renderer->setDevicePixelRatio(devicePixelRatio);
683 renderer->setDeviceRect(QRect(QPoint(0, 0), pixelSize));
684 renderer->setViewportRect(QRect(QPoint(0, 0), pixelSize));
686 QSGAbstractRenderer::MatrixTransformFlags matrixFlags;
687 bool flipY = rhi ? !rhi->isYUpInNDC() :
false;
688 if (!customRenderTarget.isNull() && customRenderTarget.mirrorVertically())
691 matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
693 const QRectF rect(QPointF(0, 0), pixelSize / devicePixelRatio);
694 renderer->setProjectionMatrixToRect(rect, matrixFlags, rhi && !rhi->isYUpInNDC());
696 context->renderNextFrame(renderer);
698 emit q->afterRendering();
699 runAndClearJobs(&afterRenderingJobs);
701 context->endNextFrame(renderer);
703 if (renderer && renderer->hasVisualizationModeWithContinuousUpdate()) {
707 QCoreApplication::postEvent(q,
new QEvent(QEvent::Type(FullUpdateRequest)));
782void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
789 contentItem =
new QQuickRootItem;
790 contentItem->setObjectName(q->objectName());
791 QQml_setParent_noEvent(contentItem, c);
792 QQmlEngine::setObjectOwnership(contentItem, QQmlEngine::CppOwnership);
793 QQuickItemPrivate *contentItemPrivate = QQuickItemPrivate::get(contentItem);
794 contentItemPrivate->window = q;
795 contentItemPrivate->windowRefCount = 1;
796 contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope;
797 contentItem->setSize(q->size());
798 deliveryAgent =
new QQuickDeliveryAgent(contentItem);
800 visualizationMode = qgetenv(
"QSG_VISUALIZE");
801 renderControl = control;
803 QQuickRenderControlPrivate::get(renderControl)->window = q;
806 windowManager = QSGRenderLoop::instance();
808 Q_ASSERT(windowManager || renderControl);
810 QObject::connect(
static_cast<QGuiApplication *>(QGuiApplication::instance()),
811 &QGuiApplication::fontDatabaseChanged,
813 &QQuickWindow::handleFontDatabaseChanged);
816 lastReportedItemDevicePixelRatio = q->effectiveDevicePixelRatio();
821 QQuickRenderControlPrivate *renderControlPriv = QQuickRenderControlPrivate::get(renderControl);
822 sg = renderControlPriv->sg;
823 context = renderControlPriv->rc;
825 windowManager->addWindow(q);
826 sg = windowManager->sceneGraphContext();
827 context = windowManager->createRenderContext(sg);
830 q->setSurfaceType(windowManager ? windowManager->windowSurfaceType() : QSurface::OpenGLSurface);
831 q->setFormat(sg->defaultSurfaceFormat());
837 animationController.reset(
new QQuickAnimatorController(q));
840 QObject::connect(context, &QSGRenderContext::initialized, q, &QQuickWindow::sceneGraphInitialized, Qt::DirectConnection),
841 QObject::connect(context, &QSGRenderContext::invalidated, q, &QQuickWindow::sceneGraphInvalidated, Qt::DirectConnection),
842 QObject::connect(context, &QSGRenderContext::invalidated, q, &QQuickWindow::cleanupSceneGraph, Qt::DirectConnection),
844 QObject::connect(q, &QQuickWindow::focusObjectChanged, q, &QQuickWindow::activeFocusItemChanged),
845 QObject::connect(q, &QQuickWindow::screenChanged, q, &QQuickWindow::handleScreenChanged),
846 QObject::connect(qApp, &QGuiApplication::applicationStateChanged, q, &QQuickWindow::handleApplicationStateChanged),
847 QObject::connect(q, &QQuickWindow::frameSwapped, q, &QQuickWindow::runJobsAfterSwap, Qt::DirectConnection),
850 if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>())
851 service->addWindow(q);
1234QQuickWindow::~QQuickWindow()
1237 d->inDestructor =
true;
1238 if (d->renderControl) {
1239 QQuickRenderControlPrivate::get(d->renderControl)->windowDestroyed();
1240 }
else if (d->windowManager) {
1241 d->windowManager->removeWindow(
this);
1242 d->windowManager->windowDestroyed(
this);
1245 disconnect(
this, &QQuickWindow::focusObjectChanged,
this, &QQuickWindow::activeFocusItemChanged);
1246 disconnect(
this, &QQuickWindow::screenChanged,
this, &QQuickWindow::handleScreenChanged);
1247 disconnect(qApp, &QGuiApplication::applicationStateChanged,
this, &QQuickWindow::handleApplicationStateChanged);
1248 disconnect(
this, &QQuickWindow::frameSwapped,
this, &QQuickWindow::runJobsAfterSwap);
1250 delete d->incubationController; d->incubationController =
nullptr;
1251 QQuickRootItem *root = d->contentItem;
1252 d->contentItem =
nullptr;
1253 root->setParent(
nullptr);
1255 d->deliveryAgent =
nullptr;
1259 const std::lock_guard locker(d->renderJobMutex);
1260 qDeleteAll(std::exchange(d->beforeSynchronizingJobs, {}));
1261 qDeleteAll(std::exchange(d->afterSynchronizingJobs, {}));
1262 qDeleteAll(std::exchange(d->beforeRenderingJobs, {}));
1263 qDeleteAll(std::exchange(d->afterRenderingJobs, {}));;
1264 qDeleteAll(std::exchange(d->afterSwapJobs, {}));
1272 QQuickPixmap::purgeCache();
1274 for (QMetaObject::Connection &connection : d->connections)
1275 disconnect(connection);
1473bool QQuickWindow::event(QEvent *event)
1478 QQuickDeliveryAgent *da = d->deliveryAgent;
1479 if (event->isPointerEvent()) {
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490 if (d->windowEventDispatch)
1493 const bool wasAccepted = event->isAccepted();
1494 QScopedValueRollback windowEventDispatchGuard(d->windowEventDispatch,
true);
1495 qCDebug(lcPtr) <<
"dispatching to window functions in case of override" << event;
1496 QWindow::event(event);
1497 if (event->isAccepted() && !wasAccepted)
1501
1502
1503
1504
1505
1506
1507 auto pe =
static_cast<QPointerEvent *>(event);
1508 if (QQuickDeliveryAgentPrivate::isTouchEvent(pe))
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525 if (pe->pointCount()) {
1526 const bool synthMouse = QQuickDeliveryAgentPrivate::isSynthMouse(pe);
1527 if (QQuickDeliveryAgentPrivate::subsceneAgentsExist) {
1531 QFlatMap<QQuickDeliveryAgent*, QList<QEventPoint>> deliveryAgentsNeedingPoints;
1532 QEventPoint::States eventStates;
1534 auto insert = [&](QQuickDeliveryAgent *ptda,
const QEventPoint &pt) {
1535 if (pt.state() == QEventPoint::Pressed && !synthMouse)
1536 pe->clearPassiveGrabbers(pt);
1537 auto &ptList = deliveryAgentsNeedingPoints[ptda];
1538 auto idEquals = [](
auto id) {
return [id] (
const auto &e) {
return e.id() == id; }; };
1539 if (std::none_of(ptList.cbegin(), ptList.cend(), idEquals(pt.id())))
1543 for (
const auto &pt : pe->points()) {
1544 eventStates |= pt.state();
1545 auto epd = QPointingDevicePrivate::get(
const_cast<QPointingDevice*>(pe->pointingDevice()))->queryPointById(pt.id());
1547 bool foundAgent =
false;
1548 if (!epd->exclusiveGrabber.isNull() && !epd->exclusiveGrabberContext.isNull()) {
1549 if (
auto ptda = qobject_cast<QQuickDeliveryAgent *>(epd->exclusiveGrabberContext.data())) {
1551 qCDebug(lcPtr) << pe->type() <<
"point" << pt.id() << pt.state()
1552 <<
"@" << pt.scenePosition() <<
"will be re-delivered via known grabbing agent" << ptda <<
"to" << epd->exclusiveGrabber.data();
1556 for (
const auto &pgda : std::as_const(epd->passiveGrabbersContext)) {
1557 if (
auto ptda = qobject_cast<QQuickDeliveryAgent *>(pgda.data())) {
1559 qCDebug(lcPtr) << pe->type() <<
"point" << pt.id() << pt.state()
1560 <<
"@" << pt.scenePosition() <<
"will be re-delivered via known passive-grabbing agent" << ptda;
1568 for (
auto daAndPoints : deliveryAgentsNeedingPoints) {
1569 if (pe->pointCount() > 1) {
1570 Q_ASSERT(QQuickDeliveryAgentPrivate::isTouchEvent(pe));
1572 QEvent::Type eventType = pe->type();
1573 switch (eventStates) {
1574 case QEventPoint::State::Pressed:
1575 eventType = QEvent::TouchBegin;
1577 case QEventPoint::State::Released:
1578 eventType = QEvent::TouchEnd;
1581 eventType = QEvent::TouchUpdate;
1585 QMutableTouchEvent te(eventType, pe->pointingDevice(), pe->modifiers(), daAndPoints.second);
1586 te.setTimestamp(pe->timestamp());
1588 qCDebug(lcTouch) << daAndPoints.first <<
"shall now receive" << &te;
1589 ret = daAndPoints.first->event(&te) || ret;
1591 qCDebug(lcPtr) << daAndPoints.first <<
"shall now receive" << pe;
1592 ret = daAndPoints.first->event(pe) || ret;
1597 d->deliveryAgentPrivate()->clearGrabbers(pe);
1600 }
else if (!synthMouse) {
1603 for (
const auto &pt : pe->points()) {
1604 if (pt.state() == QEventPoint::Pressed)
1605 pe->clearPassiveGrabbers(pt);
1614 qCDebug(lcHoverTrace) <<
this <<
"some sort of event" << event;
1615 bool ret = (da && da->event(event));
1629 if (pe->isPointerEvent() && !QQuickDeliveryAgentPrivate::isTabletEvent(pe) && d->isPopup()
1630 && std::any_of(std::cbegin(pe->points()), std::cend(pe->points()), [pe](
auto &p){
return pe->exclusiveGrabber(p);}))
1633 d->deliveryAgentPrivate()->clearGrabbers(pe);
1635 if (pe->type() == QEvent::MouseButtonPress || pe->type() == QEvent::MouseButtonRelease) {
1638 d->maybeSynthesizeContextMenuEvent(
static_cast<QMouseEvent *>(pe));
1641#if QT_CONFIG(tabletevent)
1648 if (type() == Qt::Popup && QQuickDeliveryAgentPrivate::isTabletEvent(pe) &&
1649 !QRect(QPoint(), size()).contains(pe->points().first().scenePosition().toPoint())) {
1657 }
else if (event->isInputEvent()) {
1658 if (da && da->event(event))
1662 switch (event->type()) {
1664 case QEvent::FocusAboutToChange:
1667 case QEvent::InputMethod:
1668 case QEvent::InputMethodQuery:
1669#if QT_CONFIG(quick_draganddrop)
1670 case QEvent::DragEnter:
1671 case QEvent::DragLeave:
1672 case QEvent::DragMove:
1675 if (d->inDestructor)
1677 if (da && da->event(event))
1680 case QEvent::LanguageChange:
1681 case QEvent::LocaleChange:
1683 QCoreApplication::sendEvent(d->contentItem, event);
1685 case QEvent::UpdateRequest:
1686 if (d->windowManager)
1687 d->windowManager->handleUpdateRequest(
this);
1689 case QEvent::PlatformSurface:
1690 if ((
static_cast<QPlatformSurfaceEvent *>(event))->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) {
1693 if (d->windowManager)
1694 d->windowManager->hide(
this);
1697 case QEvent::WindowDeactivate:
1698 if (
auto da = d->deliveryAgentPrivate())
1699 da->handleWindowDeactivate(
this);
1701 case QEvent::WindowActivate:
1703 QCoreApplication::sendEvent(d->contentItem, event);
1705 case QEvent::ApplicationPaletteChange:
1706 d->inheritPalette(QGuiApplication::palette());
1708 QCoreApplication::sendEvent(d->contentItem, event);
1710 case QEvent::DevicePixelRatioChange:
1711 physicalDpiChanged();
1713 case QEvent::SafeAreaMarginsChange:
1714 QQuickSafeArea::updateSafeAreasRecursively(d->contentItem);
1716 case QEvent::ChildWindowAdded: {
1717 auto *childEvent =
static_cast<QChildWindowEvent*>(event);
1718 auto *childWindow = childEvent->child();
1719 qCDebug(lcQuickWindow) <<
"Child window" << childWindow <<
"added to" <<
this;
1720 if (childWindow->handle()) {
1726 d->updateChildWindowStackingOrder();
1728 qCDebug(lcQuickWindow) <<
"No platform window yet."
1729 <<
"Deferring child window stacking until surface creation";
1737 if (event->type() == QEvent::Type(QQuickWindowPrivate::FullUpdateRequest))
1739 else if (event->type() == QEvent::Type(QQuickWindowPrivate::TriggerContextCreationFailure))
1740 d->windowManager->handleContextCreationFailure(
this);
1742 if (event->isPointerEvent())
1745 return QWindow::event(event);
2221void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
2223 QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
2224 quint32 dirty = itemPriv->dirtyAttributes;
2225 itemPriv->dirtyAttributes = 0;
2227 if ((dirty & QQuickItemPrivate::TransformUpdateMask) ||
2228 (dirty & QQuickItemPrivate::Size && itemPriv->origin() != QQuickItem::TopLeft &&
2229 (itemPriv->scale() != 1. || itemPriv->rotation() != 0.))) {
2233 if (itemPriv->x != 0. || itemPriv->y != 0.)
2234 matrix.translate(itemPriv->x, itemPriv->y);
2236 for (
int ii = itemPriv->transforms.size() - 1; ii >= 0; --ii)
2237 itemPriv->transforms.at(ii)->applyTo(&matrix);
2239 if (itemPriv->scale() != 1. || itemPriv->rotation() != 0.) {
2240 QPointF origin = item->transformOriginPoint();
2241 matrix.translate(origin.x(), origin.y());
2242 if (itemPriv->scale() != 1.)
2243 matrix.scale(itemPriv->scale(), itemPriv->scale());
2244 if (itemPriv->rotation() != 0.)
2245 matrix.rotate(itemPriv->rotation(), 0, 0, 1);
2246 matrix.translate(-origin.x(), -origin.y());
2249 itemPriv->itemNode()->setMatrix(matrix);
2252 const bool clipEffectivelyChanged = dirty & (QQuickItemPrivate::Clip | QQuickItemPrivate::Window);
2253 if (clipEffectivelyChanged) {
2254 QSGNode *parent = itemPriv->opacityNode() ? (QSGNode *)itemPriv->opacityNode()
2255 : (QSGNode *)itemPriv->itemNode();
2256 QSGNode *child = itemPriv->rootNode();
2258 if (
bool initializeClipNode = item->clip() && itemPriv->clipNode() ==
nullptr;
2259 initializeClipNode) {
2260 QQuickDefaultClipNode *clip =
new QQuickDefaultClipNode(item->clipRect());
2261 itemPriv->extra.value().clipNode = clip;
2265 parent->reparentChildNodesTo(clip);
2266 parent->appendChildNode(clip);
2268 parent->removeChildNode(child);
2269 clip->appendChildNode(child);
2270 parent->appendChildNode(clip);
2273 }
else if (
bool updateClipNode = item->clip() && itemPriv->clipNode() !=
nullptr;
2275 QQuickDefaultClipNode *clip = itemPriv->clipNode();
2276 clip->setClipRect(item->clipRect());
2278 }
else if (
bool removeClipNode = !item->clip() && itemPriv->clipNode() !=
nullptr;
2280 QQuickDefaultClipNode *clip = itemPriv->clipNode();
2281 parent->removeChildNode(clip);
2283 clip->removeChildNode(child);
2284 parent->appendChildNode(child);
2286 clip->reparentChildNodesTo(parent);
2289 delete itemPriv->clipNode();
2290 itemPriv->extra->clipNode =
nullptr;
2294 const int effectRefCount = itemPriv->extra.isAllocated() ? itemPriv->extra->effectRefCount : 0;
2295 const bool effectRefEffectivelyChanged =
2296 (dirty & (QQuickItemPrivate::EffectReference | QQuickItemPrivate::Window))
2297 && ((effectRefCount == 0) != (itemPriv->rootNode() ==
nullptr));
2298 if (effectRefEffectivelyChanged) {
2299 if (dirty & QQuickItemPrivate::ChildrenUpdateMask)
2300 itemPriv->childContainerNode()->removeAllChildNodes();
2302 QSGNode *parent = itemPriv->clipNode();
2304 parent = itemPriv->opacityNode();
2306 parent = itemPriv->itemNode();
2308 if (itemPriv->extra.isAllocated() && itemPriv->extra->effectRefCount) {
2309 Q_ASSERT(itemPriv->rootNode() ==
nullptr);
2310 QSGRootNode *root =
new QSGRootNode();
2311 itemPriv->extra->rootNode = root;
2312 parent->reparentChildNodesTo(root);
2313 parent->appendChildNode(root);
2315 Q_ASSERT(itemPriv->rootNode() !=
nullptr);
2316 QSGRootNode *root = itemPriv->rootNode();
2317 parent->removeChildNode(root);
2318 root->reparentChildNodesTo(parent);
2319 delete itemPriv->rootNode();
2320 itemPriv->extra->rootNode =
nullptr;
2324 if (dirty & QQuickItemPrivate::ChildrenUpdateMask) {
2326 bool fetchedPaintNode =
false;
2327 QList<QQuickItem *> orderedChildren = itemPriv->paintOrderChildItems();
2328 int desiredNodesSize = orderedChildren.size() + (itemPriv->paintNode ? 1 : 0);
2336 int desiredNodesProcessed = 0;
2341 QSGNode *groupNode = itemPriv->childContainerNode();
2342 QSGNode *currentNode = groupNode->firstChild();
2343 QSGNode *desiredNode =
nullptr;
2345 while (currentNode && (desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) {
2346 if (currentNode != desiredNode) {
2349 if (currentNode->nextSibling() == desiredNode) {
2351 groupNode->removeChildNode(currentNode);
2356 if (desiredNode->parent()) {
2357 desiredNode->parent()->removeChildNode(desiredNode);
2359 groupNode->insertChildNodeBefore(desiredNode, currentNode);
2363 currentNode = desiredNode;
2366 currentNode = currentNode->nextSibling();
2367 desiredNodesProcessed++;
2373 if (desiredNodesProcessed < desiredNodesSize) {
2374 while ((desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) {
2375 if (desiredNode->parent())
2376 desiredNode->parent()->removeChildNode(desiredNode);
2377 groupNode->appendChildNode(desiredNode);
2379 }
else if (currentNode) {
2383 while (currentNode) {
2384 QSGNode *node = currentNode->nextSibling();
2385 groupNode->removeChildNode(currentNode);
2391 if ((dirty & QQuickItemPrivate::Size) && itemPriv->clipNode()) {
2392 itemPriv->clipNode()->setRect(item->clipRect());
2393 itemPriv->clipNode()->update();
2396 if (dirty & (QQuickItemPrivate::OpacityValue | QQuickItemPrivate::Visible
2397 | QQuickItemPrivate::HideReference | QQuickItemPrivate::Window))
2399 qreal opacity = itemPriv->explicitVisible && (!itemPriv->extra.isAllocated() || itemPriv->extra->hideRefCount == 0)
2400 ? itemPriv->opacity() : qreal(0);
2402 if (opacity != 1 && !itemPriv->opacityNode()) {
2403 QSGOpacityNode *node =
new QSGOpacityNode;
2404 itemPriv->extra.value().opacityNode = node;
2406 QSGNode *parent = itemPriv->itemNode();
2407 QSGNode *child = itemPriv->clipNode();
2409 child = itemPriv->rootNode();
2412 parent->removeChildNode(child);
2413 node->appendChildNode(child);
2414 parent->appendChildNode(node);
2416 parent->reparentChildNodesTo(node);
2417 parent->appendChildNode(node);
2420 if (itemPriv->opacityNode())
2421 itemPriv->opacityNode()->setOpacity(opacity);
2424 if (dirty & QQuickItemPrivate::ContentUpdateMask) {
2426 if (itemPriv->flags & QQuickItem::ItemHasContents) {
2427 updatePaintNodeData.transformNode = itemPriv->itemNode();
2428 itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData);
2430 Q_ASSERT(itemPriv->paintNode ==
nullptr ||
2431 itemPriv->paintNode->parent() ==
nullptr ||
2432 itemPriv->paintNode->parent() == itemPriv->childContainerNode());
2434 if (itemPriv->paintNode) {
2435 if (itemPriv->paintNode->parent() ==
nullptr) {
2436 QSGNode *before = qquickitem_before_paintNode(itemPriv);
2437 if (before && before->parent()) {
2438 Q_ASSERT(before->parent() == itemPriv->childContainerNode());
2439 itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, before);
2441 itemPriv->childContainerNode()->prependChildNode(itemPriv->paintNode);
2448 if (itemPriv->extra.isAllocated() && itemPriv->extra->mutabilityGroupSet) {
2449 QSGNodePrivate::setMutabilityGroupOfSubtree(itemPriv->paintNode,
2450 itemPriv->extra->mutabilityGroup);
2454 }
else if (itemPriv->paintNode) {
2455 delete itemPriv->paintNode;
2456 itemPriv->paintNode =
nullptr;
2463 QList<QSGNode *> nodes;
2464 nodes << itemPriv->itemNodeInstance
2465 << itemPriv->opacityNode()
2466 << itemPriv->clipNode()
2467 << itemPriv->rootNode()
2468 << itemPriv->paintNode;
2469 nodes.removeAll(
nullptr);
2471 Q_ASSERT(nodes.constFirst() == itemPriv->itemNodeInstance);
2472 for (
int i=1; i<nodes.size(); ++i) {
2473 QSGNode *n = nodes.at(i);
2475 Q_ASSERT(n->parent() == nodes.at(i-1));
2477 Q_ASSERT(n == itemPriv->paintNode || n == itemPriv->childContainerNode() || n->childCount() == 1);