523void QQuickWindowPrivate::syncSceneGraph()
527 const bool wasRtDirty = redirect.renderTargetDirty;
528 ensureCustomRenderTarget();
530 QRhiCommandBuffer *cb =
nullptr;
532 if (redirect.commandBuffer)
533 cb = redirect.commandBuffer;
535 cb = swapchain->currentFrameCommandBuffer();
537 context->prepareSync(q->effectiveDevicePixelRatio(), cb, graphicsConfig);
539 animationController->beforeNodeSync();
541 emit q->beforeSynchronizing();
542 runAndClearJobs(&beforeSynchronizingJobs);
544 if (pendingFontUpdate) {
546 invalidateFontData(contentItem);
547 context->invalidateGlyphCaches();
550 if (Q_UNLIKELY(!renderer)) {
551 forceUpdate(contentItem);
553 QSGRootNode *rootNode =
new QSGRootNode;
554 rootNode->appendChildNode(QQuickItemPrivate::get(contentItem)->itemNode());
555 const bool useDepth = graphicsConfig.isDepthBufferEnabledFor2D();
556 const QSGRendererInterface::RenderMode renderMode = useDepth ? QSGRendererInterface::RenderMode2D
557 : QSGRendererInterface::RenderMode2DNoDepthBuffer;
558 renderer = context->createRenderer(renderMode);
559 renderer->setRootNode(rootNode);
560 }
else if (Q_UNLIKELY(wasRtDirty)
561 && q->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) {
562 auto softwareRenderer =
static_cast<QSGSoftwareRenderer *>(renderer);
563 softwareRenderer->markDirty();
568 animationController->afterNodeSync();
570 renderer->setClearColor(clearColor);
572 renderer->setVisualizationMode(visualizationMode);
574 if (pendingFontUpdate) {
575 context->flushGlyphCaches();
576 pendingFontUpdate =
false;
579 emit q->afterSynchronizing();
580 runAndClearJobs(&afterSynchronizingJobs);
619void QQuickWindowPrivate::renderSceneGraph()
625 ensureCustomRenderTarget();
627 QSGRenderTarget sgRenderTarget;
629 QRhiRenderTarget *rt;
630 QRhiRenderPassDescriptor *rp;
631 QRhiCommandBuffer *cb;
632 if (redirect.rt.rt.renderTarget) {
633 rt = redirect.rt.rt.renderTarget;
634 rp = rt->renderPassDescriptor();
636 qWarning(
"Custom render target is set but no renderpass descriptor has been provided.");
639 cb = redirect.commandBuffer;
641 qWarning(
"Custom render target is set but no command buffer has been provided.");
646 qWarning(
"QQuickWindow: No render target (neither swapchain nor custom target was provided)");
649 rt = swapchain->currentFrameRenderTarget();
650 rp = rpDescForSwapchain;
651 cb = swapchain->currentFrameCommandBuffer();
653 sgRenderTarget = QSGRenderTarget(rt, rp, cb);
654 sgRenderTarget.multiViewCount = multiViewCount();
656 sgRenderTarget = QSGRenderTarget(redirect.rt.sw.paintDevice);
659 context->beginNextFrame(renderer,
661 emitBeforeRenderPassRecording,
662 emitAfterRenderPassRecording,
665 animationController->advance();
666 emit q->beforeRendering();
667 runAndClearJobs(&beforeRenderingJobs);
669 const qreal devicePixelRatio = q->effectiveDevicePixelRatio();
671 if (redirect.rt.rt.renderTarget)
672 pixelSize = redirect.rt.rt.renderTarget->pixelSize();
673 else if (redirect.rt.sw.paintDevice)
674 pixelSize = QSize(redirect.rt.sw.paintDevice->width(), redirect.rt.sw.paintDevice->height());
676 pixelSize = swapchain->currentPixelSize();
678 pixelSize = q->size() * devicePixelRatio;
680 renderer->setDevicePixelRatio(devicePixelRatio);
681 renderer->setDeviceRect(QRect(QPoint(0, 0), pixelSize));
682 renderer->setViewportRect(QRect(QPoint(0, 0), pixelSize));
684 QSGAbstractRenderer::MatrixTransformFlags matrixFlags;
685 bool flipY = rhi ? !rhi->isYUpInNDC() :
false;
686 if (!customRenderTarget.isNull() && customRenderTarget.mirrorVertically())
689 matrixFlags |= QSGAbstractRenderer::MatrixTransformFlipY;
691 const QRectF rect(QPointF(0, 0), pixelSize / devicePixelRatio);
692 renderer->setProjectionMatrixToRect(rect, matrixFlags, rhi && !rhi->isYUpInNDC());
694 context->renderNextFrame(renderer);
696 emit q->afterRendering();
697 runAndClearJobs(&afterRenderingJobs);
699 context->endNextFrame(renderer);
701 if (renderer && renderer->hasVisualizationModeWithContinuousUpdate()) {
705 QCoreApplication::postEvent(q,
new QEvent(QEvent::Type(FullUpdateRequest)));
779void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
786 contentItem =
new QQuickRootItem;
787 contentItem->setObjectName(q->objectName());
788 QQml_setParent_noEvent(contentItem, c);
789 QQmlEngine::setObjectOwnership(contentItem, QQmlEngine::CppOwnership);
790 QQuickItemPrivate *contentItemPrivate = QQuickItemPrivate::get(contentItem);
791 contentItemPrivate->window = q;
792 contentItemPrivate->windowRefCount = 1;
793 contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope;
794 contentItem->setSize(q->size());
795 deliveryAgent =
new QQuickDeliveryAgent(contentItem);
797 visualizationMode = qgetenv(
"QSG_VISUALIZE");
798 renderControl = control;
800 QQuickRenderControlPrivate::get(renderControl)->window = q;
803 windowManager = QSGRenderLoop::instance();
805 Q_ASSERT(windowManager || renderControl);
807 QObject::connect(
static_cast<QGuiApplication *>(QGuiApplication::instance()),
808 &QGuiApplication::fontDatabaseChanged,
810 &QQuickWindow::handleFontDatabaseChanged);
813 lastReportedItemDevicePixelRatio = q->effectiveDevicePixelRatio();
818 QQuickRenderControlPrivate *renderControlPriv = QQuickRenderControlPrivate::get(renderControl);
819 sg = renderControlPriv->sg;
820 context = renderControlPriv->rc;
822 windowManager->addWindow(q);
823 sg = windowManager->sceneGraphContext();
824 context = windowManager->createRenderContext(sg);
827 q->setSurfaceType(windowManager ? windowManager->windowSurfaceType() : QSurface::OpenGLSurface);
828 q->setFormat(sg->defaultSurfaceFormat());
834 animationController.reset(
new QQuickAnimatorController(q));
837 QObject::connect(context, &QSGRenderContext::initialized, q, &QQuickWindow::sceneGraphInitialized, Qt::DirectConnection),
838 QObject::connect(context, &QSGRenderContext::invalidated, q, &QQuickWindow::sceneGraphInvalidated, Qt::DirectConnection),
839 QObject::connect(context, &QSGRenderContext::invalidated, q, &QQuickWindow::cleanupSceneGraph, Qt::DirectConnection),
841 QObject::connect(q, &QQuickWindow::focusObjectChanged, q, &QQuickWindow::activeFocusItemChanged),
842 QObject::connect(q, &QQuickWindow::screenChanged, q, &QQuickWindow::handleScreenChanged),
843 QObject::connect(qApp, &QGuiApplication::applicationStateChanged, q, &QQuickWindow::handleApplicationStateChanged),
844 QObject::connect(q, &QQuickWindow::frameSwapped, q, &QQuickWindow::runJobsAfterSwap, Qt::DirectConnection),
847 if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>())
848 service->addWindow(q);
1226QQuickWindow::~QQuickWindow()
1229 d->inDestructor =
true;
1230 if (d->renderControl) {
1231 QQuickRenderControlPrivate::get(d->renderControl)->windowDestroyed();
1232 }
else if (d->windowManager) {
1233 d->windowManager->removeWindow(
this);
1234 d->windowManager->windowDestroyed(
this);
1237 disconnect(
this, &QQuickWindow::focusObjectChanged,
this, &QQuickWindow::activeFocusItemChanged);
1238 disconnect(
this, &QQuickWindow::screenChanged,
this, &QQuickWindow::handleScreenChanged);
1239 disconnect(qApp, &QGuiApplication::applicationStateChanged,
this, &QQuickWindow::handleApplicationStateChanged);
1240 disconnect(
this, &QQuickWindow::frameSwapped,
this, &QQuickWindow::runJobsAfterSwap);
1242 delete d->incubationController; d->incubationController =
nullptr;
1243 QQuickRootItem *root = d->contentItem;
1244 d->contentItem =
nullptr;
1245 root->setParent(
nullptr);
1247 d->deliveryAgent =
nullptr;
1251 const std::lock_guard locker(d->renderJobMutex);
1252 qDeleteAll(std::exchange(d->beforeSynchronizingJobs, {}));
1253 qDeleteAll(std::exchange(d->afterSynchronizingJobs, {}));
1254 qDeleteAll(std::exchange(d->beforeRenderingJobs, {}));
1255 qDeleteAll(std::exchange(d->afterRenderingJobs, {}));;
1256 qDeleteAll(std::exchange(d->afterSwapJobs, {}));
1264 QQuickPixmap::purgeCache();
1266 for (QMetaObject::Connection &connection : d->connections)
1267 disconnect(connection);
1465bool QQuickWindow::event(QEvent *event)
1470 QQuickDeliveryAgent *da = d->deliveryAgent;
1471 if (event->isPointerEvent()) {
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482 if (d->windowEventDispatch)
1485 const bool wasAccepted = event->isAccepted();
1486 QScopedValueRollback windowEventDispatchGuard(d->windowEventDispatch,
true);
1487 qCDebug(lcPtr) <<
"dispatching to window functions in case of override" << event;
1488 QWindow::event(event);
1489 if (event->isAccepted() && !wasAccepted)
1493
1494
1495
1496
1497
1498
1499 auto pe =
static_cast<QPointerEvent *>(event);
1500 if (QQuickDeliveryAgentPrivate::isTouchEvent(pe))
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517 if (pe->pointCount()) {
1518 const bool synthMouse = QQuickDeliveryAgentPrivate::isSynthMouse(pe);
1519 if (QQuickDeliveryAgentPrivate::subsceneAgentsExist) {
1523 QFlatMap<QQuickDeliveryAgent*, QList<QEventPoint>> deliveryAgentsNeedingPoints;
1524 QEventPoint::States eventStates;
1526 auto insert = [&](QQuickDeliveryAgent *ptda,
const QEventPoint &pt) {
1527 if (pt.state() == QEventPoint::Pressed && !synthMouse)
1528 pe->clearPassiveGrabbers(pt);
1529 auto &ptList = deliveryAgentsNeedingPoints[ptda];
1530 auto idEquals = [](
auto id) {
return [id] (
const auto &e) {
return e.id() == id; }; };
1531 if (std::none_of(ptList.cbegin(), ptList.cend(), idEquals(pt.id())))
1535 for (
const auto &pt : pe->points()) {
1536 eventStates |= pt.state();
1537 auto epd = QPointingDevicePrivate::get(
const_cast<QPointingDevice*>(pe->pointingDevice()))->queryPointById(pt.id());
1539 bool foundAgent =
false;
1540 if (!epd->exclusiveGrabber.isNull() && !epd->exclusiveGrabberContext.isNull()) {
1541 if (
auto ptda = qobject_cast<QQuickDeliveryAgent *>(epd->exclusiveGrabberContext.data())) {
1543 qCDebug(lcPtr) << pe->type() <<
"point" << pt.id() << pt.state()
1544 <<
"@" << pt.scenePosition() <<
"will be re-delivered via known grabbing agent" << ptda <<
"to" << epd->exclusiveGrabber.data();
1548 for (
auto pgda : epd->passiveGrabbersContext) {
1549 if (
auto ptda = qobject_cast<QQuickDeliveryAgent *>(pgda.data())) {
1551 qCDebug(lcPtr) << pe->type() <<
"point" << pt.id() << pt.state()
1552 <<
"@" << pt.scenePosition() <<
"will be re-delivered via known passive-grabbing agent" << ptda;
1560 for (
auto daAndPoints : deliveryAgentsNeedingPoints) {
1561 if (pe->pointCount() > 1) {
1562 Q_ASSERT(QQuickDeliveryAgentPrivate::isTouchEvent(pe));
1564 QEvent::Type eventType = pe->type();
1565 switch (eventStates) {
1566 case QEventPoint::State::Pressed:
1567 eventType = QEvent::TouchBegin;
1569 case QEventPoint::State::Released:
1570 eventType = QEvent::TouchEnd;
1573 eventType = QEvent::TouchUpdate;
1577 QMutableTouchEvent te(eventType, pe->pointingDevice(), pe->modifiers(), daAndPoints.second);
1578 te.setTimestamp(pe->timestamp());
1580 qCDebug(lcTouch) << daAndPoints.first <<
"shall now receive" << &te;
1581 ret = daAndPoints.first->event(&te) || ret;
1583 qCDebug(lcPtr) << daAndPoints.first <<
"shall now receive" << pe;
1584 ret = daAndPoints.first->event(pe) || ret;
1589 d->deliveryAgentPrivate()->clearGrabbers(pe);
1592 }
else if (!synthMouse) {
1595 for (
const auto &pt : pe->points()) {
1596 if (pt.state() == QEventPoint::Pressed)
1597 pe->clearPassiveGrabbers(pt);
1606 qCDebug(lcHoverTrace) <<
this <<
"some sort of event" << event;
1607 bool ret = (da && da->event(event));
1609 d->deliveryAgentPrivate()->clearGrabbers(pe);
1611 if (pe->type() == QEvent::MouseButtonPress || pe->type() == QEvent::MouseButtonRelease) {
1614 d->maybeSynthesizeContextMenuEvent(
static_cast<QMouseEvent *>(pe));
1617#if QT_CONFIG(tabletevent)
1624 if (type() == Qt::Popup && QQuickDeliveryAgentPrivate::isTabletEvent(pe) &&
1625 !QRect(QPoint(), size()).contains(pe->points().first().scenePosition().toPoint())) {
1633 }
else if (event->isInputEvent()) {
1634 if (da && da->event(event))
1638 switch (event->type()) {
1640 case QEvent::FocusAboutToChange:
1643 case QEvent::InputMethod:
1644 case QEvent::InputMethodQuery:
1645#if QT_CONFIG(quick_draganddrop)
1646 case QEvent::DragEnter:
1647 case QEvent::DragLeave:
1648 case QEvent::DragMove:
1651 if (d->inDestructor)
1653 if (da && da->event(event))
1656 case QEvent::LanguageChange:
1657 case QEvent::LocaleChange:
1659 QCoreApplication::sendEvent(d->contentItem, event);
1661 case QEvent::UpdateRequest:
1662 if (d->windowManager)
1663 d->windowManager->handleUpdateRequest(
this);
1665 case QEvent::PlatformSurface:
1666 if ((
static_cast<QPlatformSurfaceEvent *>(event))->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) {
1669 if (d->windowManager)
1670 d->windowManager->hide(
this);
1673 case QEvent::WindowDeactivate:
1674 if (
auto da = d->deliveryAgentPrivate())
1675 da->handleWindowDeactivate(
this);
1677 case QEvent::WindowActivate:
1679 QCoreApplication::sendEvent(d->contentItem, event);
1681 case QEvent::ApplicationPaletteChange:
1682 d->inheritPalette(QGuiApplication::palette());
1684 QCoreApplication::sendEvent(d->contentItem, event);
1686 case QEvent::DevicePixelRatioChange:
1687 physicalDpiChanged();
1689 case QEvent::SafeAreaMarginsChange:
1690 QQuickSafeArea::updateSafeAreasRecursively(d->contentItem);
1692 case QEvent::ChildWindowAdded: {
1693 auto *childEvent =
static_cast<QChildWindowEvent*>(event);
1694 auto *childWindow = childEvent->child();
1695 qCDebug(lcQuickWindow) <<
"Child window" << childWindow <<
"added to" <<
this;
1696 if (childWindow->handle()) {
1702 d->updateChildWindowStackingOrder();
1704 qCDebug(lcQuickWindow) <<
"No platform window yet."
1705 <<
"Deferring child window stacking until surface creation";
1713 if (event->type() == QEvent::Type(QQuickWindowPrivate::FullUpdateRequest))
1715 else if (event->type() == QEvent::Type(QQuickWindowPrivate::TriggerContextCreationFailure))
1716 d->windowManager->handleContextCreationFailure(
this);
1718 if (event->isPointerEvent())
1721 return QWindow::event(event);
2197void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
2199 QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
2200 quint32 dirty = itemPriv->dirtyAttributes;
2201 itemPriv->dirtyAttributes = 0;
2203 if ((dirty & QQuickItemPrivate::TransformUpdateMask) ||
2204 (dirty & QQuickItemPrivate::Size && itemPriv->origin() != QQuickItem::TopLeft &&
2205 (itemPriv->scale() != 1. || itemPriv->rotation() != 0.))) {
2209 if (itemPriv->x != 0. || itemPriv->y != 0.)
2210 matrix.translate(itemPriv->x, itemPriv->y);
2212 for (
int ii = itemPriv->transforms.size() - 1; ii >= 0; --ii)
2213 itemPriv->transforms.at(ii)->applyTo(&matrix);
2215 if (itemPriv->scale() != 1. || itemPriv->rotation() != 0.) {
2216 QPointF origin = item->transformOriginPoint();
2217 matrix.translate(origin.x(), origin.y());
2218 if (itemPriv->scale() != 1.)
2219 matrix.scale(itemPriv->scale(), itemPriv->scale());
2220 if (itemPriv->rotation() != 0.)
2221 matrix.rotate(itemPriv->rotation(), 0, 0, 1);
2222 matrix.translate(-origin.x(), -origin.y());
2225 itemPriv->itemNode()->setMatrix(matrix);
2228 const bool clipEffectivelyChanged = dirty & (QQuickItemPrivate::Clip | QQuickItemPrivate::Window);
2229 if (clipEffectivelyChanged) {
2230 QSGNode *parent = itemPriv->opacityNode() ? (QSGNode *)itemPriv->opacityNode()
2231 : (QSGNode *)itemPriv->itemNode();
2232 QSGNode *child = itemPriv->rootNode();
2234 if (
bool initializeClipNode = item->clip() && itemPriv->clipNode() ==
nullptr;
2235 initializeClipNode) {
2236 QQuickDefaultClipNode *clip =
new QQuickDefaultClipNode(item->clipRect());
2237 itemPriv->extra.value().clipNode = clip;
2241 parent->reparentChildNodesTo(clip);
2242 parent->appendChildNode(clip);
2244 parent->removeChildNode(child);
2245 clip->appendChildNode(child);
2246 parent->appendChildNode(clip);
2249 }
else if (
bool updateClipNode = item->clip() && itemPriv->clipNode() !=
nullptr;
2251 QQuickDefaultClipNode *clip = itemPriv->clipNode();
2252 clip->setClipRect(item->clipRect());
2254 }
else if (
bool removeClipNode = !item->clip() && itemPriv->clipNode() !=
nullptr;
2256 QQuickDefaultClipNode *clip = itemPriv->clipNode();
2257 parent->removeChildNode(clip);
2259 clip->removeChildNode(child);
2260 parent->appendChildNode(child);
2262 clip->reparentChildNodesTo(parent);
2265 delete itemPriv->clipNode();
2266 itemPriv->extra->clipNode =
nullptr;
2270 const int effectRefCount = itemPriv->extra.isAllocated() ? itemPriv->extra->effectRefCount : 0;
2271 const bool effectRefEffectivelyChanged =
2272 (dirty & (QQuickItemPrivate::EffectReference | QQuickItemPrivate::Window))
2273 && ((effectRefCount == 0) != (itemPriv->rootNode() ==
nullptr));
2274 if (effectRefEffectivelyChanged) {
2275 if (dirty & QQuickItemPrivate::ChildrenUpdateMask)
2276 itemPriv->childContainerNode()->removeAllChildNodes();
2278 QSGNode *parent = itemPriv->clipNode();
2280 parent = itemPriv->opacityNode();
2282 parent = itemPriv->itemNode();
2284 if (itemPriv->extra.isAllocated() && itemPriv->extra->effectRefCount) {
2285 Q_ASSERT(itemPriv->rootNode() ==
nullptr);
2286 QSGRootNode *root =
new QSGRootNode();
2287 itemPriv->extra->rootNode = root;
2288 parent->reparentChildNodesTo(root);
2289 parent->appendChildNode(root);
2291 Q_ASSERT(itemPriv->rootNode() !=
nullptr);
2292 QSGRootNode *root = itemPriv->rootNode();
2293 parent->removeChildNode(root);
2294 root->reparentChildNodesTo(parent);
2295 delete itemPriv->rootNode();
2296 itemPriv->extra->rootNode =
nullptr;
2300 if (dirty & QQuickItemPrivate::ChildrenUpdateMask) {
2302 bool fetchedPaintNode =
false;
2303 QList<QQuickItem *> orderedChildren = itemPriv->paintOrderChildItems();
2304 int desiredNodesSize = orderedChildren.size() + (itemPriv->paintNode ? 1 : 0);
2312 int desiredNodesProcessed = 0;
2317 QSGNode *groupNode = itemPriv->childContainerNode();
2318 QSGNode *currentNode = groupNode->firstChild();
2319 QSGNode *desiredNode =
nullptr;
2321 while (currentNode && (desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) {
2322 if (currentNode != desiredNode) {
2325 if (currentNode->nextSibling() == desiredNode) {
2327 groupNode->removeChildNode(currentNode);
2332 if (desiredNode->parent()) {
2333 desiredNode->parent()->removeChildNode(desiredNode);
2335 groupNode->insertChildNodeBefore(desiredNode, currentNode);
2339 currentNode = desiredNode;
2342 currentNode = currentNode->nextSibling();
2343 desiredNodesProcessed++;
2349 if (desiredNodesProcessed < desiredNodesSize) {
2350 while ((desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) {
2351 if (desiredNode->parent())
2352 desiredNode->parent()->removeChildNode(desiredNode);
2353 groupNode->appendChildNode(desiredNode);
2355 }
else if (currentNode) {
2359 while (currentNode) {
2360 QSGNode *node = currentNode->nextSibling();
2361 groupNode->removeChildNode(currentNode);
2367 if ((dirty & QQuickItemPrivate::Size) && itemPriv->clipNode()) {
2368 itemPriv->clipNode()->setRect(item->clipRect());
2369 itemPriv->clipNode()->update();
2372 if (dirty & (QQuickItemPrivate::OpacityValue | QQuickItemPrivate::Visible
2373 | QQuickItemPrivate::HideReference | QQuickItemPrivate::Window))
2375 qreal opacity = itemPriv->explicitVisible && (!itemPriv->extra.isAllocated() || itemPriv->extra->hideRefCount == 0)
2376 ? itemPriv->opacity() : qreal(0);
2378 if (opacity != 1 && !itemPriv->opacityNode()) {
2379 QSGOpacityNode *node =
new QSGOpacityNode;
2380 itemPriv->extra.value().opacityNode = node;
2382 QSGNode *parent = itemPriv->itemNode();
2383 QSGNode *child = itemPriv->clipNode();
2385 child = itemPriv->rootNode();
2388 parent->removeChildNode(child);
2389 node->appendChildNode(child);
2390 parent->appendChildNode(node);
2392 parent->reparentChildNodesTo(node);
2393 parent->appendChildNode(node);
2396 if (itemPriv->opacityNode())
2397 itemPriv->opacityNode()->setOpacity(opacity);
2400 if (dirty & QQuickItemPrivate::ContentUpdateMask) {
2402 if (itemPriv->flags & QQuickItem::ItemHasContents) {
2403 updatePaintNodeData.transformNode = itemPriv->itemNode();
2404 itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData);
2406 Q_ASSERT(itemPriv->paintNode ==
nullptr ||
2407 itemPriv->paintNode->parent() ==
nullptr ||
2408 itemPriv->paintNode->parent() == itemPriv->childContainerNode());
2410 if (itemPriv->paintNode && itemPriv->paintNode->parent() ==
nullptr) {
2411 QSGNode *before = qquickitem_before_paintNode(itemPriv);
2412 if (before && before->parent()) {
2413 Q_ASSERT(before->parent() == itemPriv->childContainerNode());
2414 itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, before);
2416 itemPriv->childContainerNode()->prependChildNode(itemPriv->paintNode);
2419 }
else if (itemPriv->paintNode) {
2420 delete itemPriv->paintNode;
2421 itemPriv->paintNode =
nullptr;
2428 QList<QSGNode *> nodes;
2429 nodes << itemPriv->itemNodeInstance
2430 << itemPriv->opacityNode()
2431 << itemPriv->clipNode()
2432 << itemPriv->rootNode()
2433 << itemPriv->paintNode;
2434 nodes.removeAll(
nullptr);
2436 Q_ASSERT(nodes.constFirst() == itemPriv->itemNodeInstance);
2437 for (
int i=1; i<nodes.size(); ++i) {
2438 QSGNode *n = nodes.at(i);
2440 Q_ASSERT(n->parent() == nodes.at(i-1));
2442 Q_ASSERT(n == itemPriv->paintNode || n == itemPriv->childContainerNode() || n->childCount() == 1);