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)));
780void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
787 contentItem =
new QQuickRootItem;
788 contentItem->setObjectName(q->objectName());
789 QQml_setParent_noEvent(contentItem, c);
790 QQmlEngine::setObjectOwnership(contentItem, QQmlEngine::CppOwnership);
791 QQuickItemPrivate *contentItemPrivate = QQuickItemPrivate::get(contentItem);
792 contentItemPrivate->window = q;
793 contentItemPrivate->windowRefCount = 1;
794 contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope;
795 contentItem->setSize(q->size());
796 deliveryAgent =
new QQuickDeliveryAgent(contentItem);
798 visualizationMode = qgetenv(
"QSG_VISUALIZE");
799 renderControl = control;
801 QQuickRenderControlPrivate::get(renderControl)->window = q;
804 windowManager = QSGRenderLoop::instance();
806 Q_ASSERT(windowManager || renderControl);
808 QObject::connect(
static_cast<QGuiApplication *>(QGuiApplication::instance()),
809 &QGuiApplication::fontDatabaseChanged,
811 &QQuickWindow::handleFontDatabaseChanged);
814 lastReportedItemDevicePixelRatio = q->effectiveDevicePixelRatio();
819 QQuickRenderControlPrivate *renderControlPriv = QQuickRenderControlPrivate::get(renderControl);
820 sg = renderControlPriv->sg;
821 context = renderControlPriv->rc;
823 windowManager->addWindow(q);
824 sg = windowManager->sceneGraphContext();
825 context = windowManager->createRenderContext(sg);
828 q->setSurfaceType(windowManager ? windowManager->windowSurfaceType() : QSurface::OpenGLSurface);
829 q->setFormat(sg->defaultSurfaceFormat());
835 animationController.reset(
new QQuickAnimatorController(q));
838 QObject::connect(context, &QSGRenderContext::initialized, q, &QQuickWindow::sceneGraphInitialized, Qt::DirectConnection),
839 QObject::connect(context, &QSGRenderContext::invalidated, q, &QQuickWindow::sceneGraphInvalidated, Qt::DirectConnection),
840 QObject::connect(context, &QSGRenderContext::invalidated, q, &QQuickWindow::cleanupSceneGraph, Qt::DirectConnection),
842 QObject::connect(q, &QQuickWindow::focusObjectChanged, q, &QQuickWindow::activeFocusItemChanged),
843 QObject::connect(q, &QQuickWindow::screenChanged, q, &QQuickWindow::handleScreenChanged),
844 QObject::connect(qApp, &QGuiApplication::applicationStateChanged, q, &QQuickWindow::handleApplicationStateChanged),
845 QObject::connect(q, &QQuickWindow::frameSwapped, q, &QQuickWindow::runJobsAfterSwap, Qt::DirectConnection),
848 if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>())
849 service->addWindow(q);
1227QQuickWindow::~QQuickWindow()
1230 d->inDestructor =
true;
1231 if (d->renderControl) {
1232 QQuickRenderControlPrivate::get(d->renderControl)->windowDestroyed();
1233 }
else if (d->windowManager) {
1234 d->windowManager->removeWindow(
this);
1235 d->windowManager->windowDestroyed(
this);
1238 disconnect(
this, &QQuickWindow::focusObjectChanged,
this, &QQuickWindow::activeFocusItemChanged);
1239 disconnect(
this, &QQuickWindow::screenChanged,
this, &QQuickWindow::handleScreenChanged);
1240 disconnect(qApp, &QGuiApplication::applicationStateChanged,
this, &QQuickWindow::handleApplicationStateChanged);
1241 disconnect(
this, &QQuickWindow::frameSwapped,
this, &QQuickWindow::runJobsAfterSwap);
1243 delete d->incubationController; d->incubationController =
nullptr;
1244 QQuickRootItem *root = d->contentItem;
1245 d->contentItem =
nullptr;
1246 root->setParent(
nullptr);
1248 d->deliveryAgent =
nullptr;
1252 const std::lock_guard locker(d->renderJobMutex);
1253 qDeleteAll(std::exchange(d->beforeSynchronizingJobs, {}));
1254 qDeleteAll(std::exchange(d->afterSynchronizingJobs, {}));
1255 qDeleteAll(std::exchange(d->beforeRenderingJobs, {}));
1256 qDeleteAll(std::exchange(d->afterRenderingJobs, {}));;
1257 qDeleteAll(std::exchange(d->afterSwapJobs, {}));
1265 QQuickPixmap::purgeCache();
1267 for (QMetaObject::Connection &connection : d->connections)
1268 disconnect(connection);
1466bool QQuickWindow::event(QEvent *event)
1471 QQuickDeliveryAgent *da = d->deliveryAgent;
1472 if (event->isPointerEvent()) {
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483 if (d->windowEventDispatch)
1486 const bool wasAccepted = event->isAccepted();
1487 QScopedValueRollback windowEventDispatchGuard(d->windowEventDispatch,
true);
1488 qCDebug(lcPtr) <<
"dispatching to window functions in case of override" << event;
1489 QWindow::event(event);
1490 if (event->isAccepted() && !wasAccepted)
1494
1495
1496
1497
1498
1499
1500 auto pe =
static_cast<QPointerEvent *>(event);
1501 if (QQuickDeliveryAgentPrivate::isTouchEvent(pe))
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518 if (pe->pointCount()) {
1519 const bool synthMouse = QQuickDeliveryAgentPrivate::isSynthMouse(pe);
1520 if (QQuickDeliveryAgentPrivate::subsceneAgentsExist) {
1524 QFlatMap<QQuickDeliveryAgent*, QList<QEventPoint>> deliveryAgentsNeedingPoints;
1525 QEventPoint::States eventStates;
1527 auto insert = [&](QQuickDeliveryAgent *ptda,
const QEventPoint &pt) {
1528 if (pt.state() == QEventPoint::Pressed && !synthMouse)
1529 pe->clearPassiveGrabbers(pt);
1530 auto &ptList = deliveryAgentsNeedingPoints[ptda];
1531 auto idEquals = [](
auto id) {
return [id] (
const auto &e) {
return e.id() == id; }; };
1532 if (std::none_of(ptList.cbegin(), ptList.cend(), idEquals(pt.id())))
1536 for (
const auto &pt : pe->points()) {
1537 eventStates |= pt.state();
1538 auto epd = QPointingDevicePrivate::get(
const_cast<QPointingDevice*>(pe->pointingDevice()))->queryPointById(pt.id());
1540 bool foundAgent =
false;
1541 if (!epd->exclusiveGrabber.isNull() && !epd->exclusiveGrabberContext.isNull()) {
1542 if (
auto ptda = qobject_cast<QQuickDeliveryAgent *>(epd->exclusiveGrabberContext.data())) {
1544 qCDebug(lcPtr) << pe->type() <<
"point" << pt.id() << pt.state()
1545 <<
"@" << pt.scenePosition() <<
"will be re-delivered via known grabbing agent" << ptda <<
"to" << epd->exclusiveGrabber.data();
1549 for (
const auto &pgda : std::as_const(epd->passiveGrabbersContext)) {
1550 if (
auto ptda = qobject_cast<QQuickDeliveryAgent *>(pgda.data())) {
1552 qCDebug(lcPtr) << pe->type() <<
"point" << pt.id() << pt.state()
1553 <<
"@" << pt.scenePosition() <<
"will be re-delivered via known passive-grabbing agent" << ptda;
1561 for (
auto daAndPoints : deliveryAgentsNeedingPoints) {
1562 if (pe->pointCount() > 1) {
1563 Q_ASSERT(QQuickDeliveryAgentPrivate::isTouchEvent(pe));
1565 QEvent::Type eventType = pe->type();
1566 switch (eventStates) {
1567 case QEventPoint::State::Pressed:
1568 eventType = QEvent::TouchBegin;
1570 case QEventPoint::State::Released:
1571 eventType = QEvent::TouchEnd;
1574 eventType = QEvent::TouchUpdate;
1578 QMutableTouchEvent te(eventType, pe->pointingDevice(), pe->modifiers(), daAndPoints.second);
1579 te.setTimestamp(pe->timestamp());
1581 qCDebug(lcTouch) << daAndPoints.first <<
"shall now receive" << &te;
1582 ret = daAndPoints.first->event(&te) || ret;
1584 qCDebug(lcPtr) << daAndPoints.first <<
"shall now receive" << pe;
1585 ret = daAndPoints.first->event(pe) || ret;
1590 d->deliveryAgentPrivate()->clearGrabbers(pe);
1593 }
else if (!synthMouse) {
1596 for (
const auto &pt : pe->points()) {
1597 if (pt.state() == QEventPoint::Pressed)
1598 pe->clearPassiveGrabbers(pt);
1607 qCDebug(lcHoverTrace) <<
this <<
"some sort of event" << event;
1608 bool ret = (da && da->event(event));
1610 d->deliveryAgentPrivate()->clearGrabbers(pe);
1612 if (pe->type() == QEvent::MouseButtonPress || pe->type() == QEvent::MouseButtonRelease) {
1615 d->maybeSynthesizeContextMenuEvent(
static_cast<QMouseEvent *>(pe));
1618#if QT_CONFIG(tabletevent)
1625 if (type() == Qt::Popup && QQuickDeliveryAgentPrivate::isTabletEvent(pe) &&
1626 !QRect(QPoint(), size()).contains(pe->points().first().scenePosition().toPoint())) {
1634 }
else if (event->isInputEvent()) {
1635 if (da && da->event(event))
1639 switch (event->type()) {
1641 case QEvent::FocusAboutToChange:
1644 case QEvent::InputMethod:
1645 case QEvent::InputMethodQuery:
1646#if QT_CONFIG(quick_draganddrop)
1647 case QEvent::DragEnter:
1648 case QEvent::DragLeave:
1649 case QEvent::DragMove:
1652 if (d->inDestructor)
1654 if (da && da->event(event))
1657 case QEvent::LanguageChange:
1658 case QEvent::LocaleChange:
1660 QCoreApplication::sendEvent(d->contentItem, event);
1662 case QEvent::UpdateRequest:
1663 if (d->windowManager)
1664 d->windowManager->handleUpdateRequest(
this);
1666 case QEvent::PlatformSurface:
1667 if ((
static_cast<QPlatformSurfaceEvent *>(event))->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) {
1670 if (d->windowManager)
1671 d->windowManager->hide(
this);
1674 case QEvent::WindowDeactivate:
1675 if (
auto da = d->deliveryAgentPrivate())
1676 da->handleWindowDeactivate(
this);
1678 case QEvent::WindowActivate:
1680 QCoreApplication::sendEvent(d->contentItem, event);
1682 case QEvent::ApplicationPaletteChange:
1683 d->inheritPalette(QGuiApplication::palette());
1685 QCoreApplication::sendEvent(d->contentItem, event);
1687 case QEvent::DevicePixelRatioChange:
1688 physicalDpiChanged();
1690 case QEvent::SafeAreaMarginsChange:
1691 QQuickSafeArea::updateSafeAreasRecursively(d->contentItem);
1693 case QEvent::ChildWindowAdded: {
1694 auto *childEvent =
static_cast<QChildWindowEvent*>(event);
1695 auto *childWindow = childEvent->child();
1696 qCDebug(lcQuickWindow) <<
"Child window" << childWindow <<
"added to" <<
this;
1697 if (childWindow->handle()) {
1703 d->updateChildWindowStackingOrder();
1705 qCDebug(lcQuickWindow) <<
"No platform window yet."
1706 <<
"Deferring child window stacking until surface creation";
1714 if (event->type() == QEvent::Type(QQuickWindowPrivate::FullUpdateRequest))
1716 else if (event->type() == QEvent::Type(QQuickWindowPrivate::TriggerContextCreationFailure))
1717 d->windowManager->handleContextCreationFailure(
this);
1719 if (event->isPointerEvent())
1722 return QWindow::event(event);
2198void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
2200 QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
2201 quint32 dirty = itemPriv->dirtyAttributes;
2202 itemPriv->dirtyAttributes = 0;
2204 if ((dirty & QQuickItemPrivate::TransformUpdateMask) ||
2205 (dirty & QQuickItemPrivate::Size && itemPriv->origin() != QQuickItem::TopLeft &&
2206 (itemPriv->scale() != 1. || itemPriv->rotation() != 0.))) {
2210 if (itemPriv->x != 0. || itemPriv->y != 0.)
2211 matrix.translate(itemPriv->x, itemPriv->y);
2213 for (
int ii = itemPriv->transforms.size() - 1; ii >= 0; --ii)
2214 itemPriv->transforms.at(ii)->applyTo(&matrix);
2216 if (itemPriv->scale() != 1. || itemPriv->rotation() != 0.) {
2217 QPointF origin = item->transformOriginPoint();
2218 matrix.translate(origin.x(), origin.y());
2219 if (itemPriv->scale() != 1.)
2220 matrix.scale(itemPriv->scale(), itemPriv->scale());
2221 if (itemPriv->rotation() != 0.)
2222 matrix.rotate(itemPriv->rotation(), 0, 0, 1);
2223 matrix.translate(-origin.x(), -origin.y());
2226 itemPriv->itemNode()->setMatrix(matrix);
2229 const bool clipEffectivelyChanged = dirty & (QQuickItemPrivate::Clip | QQuickItemPrivate::Window);
2230 if (clipEffectivelyChanged) {
2231 QSGNode *parent = itemPriv->opacityNode() ? (QSGNode *)itemPriv->opacityNode()
2232 : (QSGNode *)itemPriv->itemNode();
2233 QSGNode *child = itemPriv->rootNode();
2235 if (
bool initializeClipNode = item->clip() && itemPriv->clipNode() ==
nullptr;
2236 initializeClipNode) {
2237 QQuickDefaultClipNode *clip =
new QQuickDefaultClipNode(item->clipRect());
2238 itemPriv->extra.value().clipNode = clip;
2242 parent->reparentChildNodesTo(clip);
2243 parent->appendChildNode(clip);
2245 parent->removeChildNode(child);
2246 clip->appendChildNode(child);
2247 parent->appendChildNode(clip);
2250 }
else if (
bool updateClipNode = item->clip() && itemPriv->clipNode() !=
nullptr;
2252 QQuickDefaultClipNode *clip = itemPriv->clipNode();
2253 clip->setClipRect(item->clipRect());
2255 }
else if (
bool removeClipNode = !item->clip() && itemPriv->clipNode() !=
nullptr;
2257 QQuickDefaultClipNode *clip = itemPriv->clipNode();
2258 parent->removeChildNode(clip);
2260 clip->removeChildNode(child);
2261 parent->appendChildNode(child);
2263 clip->reparentChildNodesTo(parent);
2266 delete itemPriv->clipNode();
2267 itemPriv->extra->clipNode =
nullptr;
2271 const int effectRefCount = itemPriv->extra.isAllocated() ? itemPriv->extra->effectRefCount : 0;
2272 const bool effectRefEffectivelyChanged =
2273 (dirty & (QQuickItemPrivate::EffectReference | QQuickItemPrivate::Window))
2274 && ((effectRefCount == 0) != (itemPriv->rootNode() ==
nullptr));
2275 if (effectRefEffectivelyChanged) {
2276 if (dirty & QQuickItemPrivate::ChildrenUpdateMask)
2277 itemPriv->childContainerNode()->removeAllChildNodes();
2279 QSGNode *parent = itemPriv->clipNode();
2281 parent = itemPriv->opacityNode();
2283 parent = itemPriv->itemNode();
2285 if (itemPriv->extra.isAllocated() && itemPriv->extra->effectRefCount) {
2286 Q_ASSERT(itemPriv->rootNode() ==
nullptr);
2287 QSGRootNode *root =
new QSGRootNode();
2288 itemPriv->extra->rootNode = root;
2289 parent->reparentChildNodesTo(root);
2290 parent->appendChildNode(root);
2292 Q_ASSERT(itemPriv->rootNode() !=
nullptr);
2293 QSGRootNode *root = itemPriv->rootNode();
2294 parent->removeChildNode(root);
2295 root->reparentChildNodesTo(parent);
2296 delete itemPriv->rootNode();
2297 itemPriv->extra->rootNode =
nullptr;
2301 if (dirty & QQuickItemPrivate::ChildrenUpdateMask) {
2303 bool fetchedPaintNode =
false;
2304 QList<QQuickItem *> orderedChildren = itemPriv->paintOrderChildItems();
2305 int desiredNodesSize = orderedChildren.size() + (itemPriv->paintNode ? 1 : 0);
2313 int desiredNodesProcessed = 0;
2318 QSGNode *groupNode = itemPriv->childContainerNode();
2319 QSGNode *currentNode = groupNode->firstChild();
2320 QSGNode *desiredNode =
nullptr;
2322 while (currentNode && (desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) {
2323 if (currentNode != desiredNode) {
2326 if (currentNode->nextSibling() == desiredNode) {
2328 groupNode->removeChildNode(currentNode);
2333 if (desiredNode->parent()) {
2334 desiredNode->parent()->removeChildNode(desiredNode);
2336 groupNode->insertChildNodeBefore(desiredNode, currentNode);
2340 currentNode = desiredNode;
2343 currentNode = currentNode->nextSibling();
2344 desiredNodesProcessed++;
2350 if (desiredNodesProcessed < desiredNodesSize) {
2351 while ((desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) {
2352 if (desiredNode->parent())
2353 desiredNode->parent()->removeChildNode(desiredNode);
2354 groupNode->appendChildNode(desiredNode);
2356 }
else if (currentNode) {
2360 while (currentNode) {
2361 QSGNode *node = currentNode->nextSibling();
2362 groupNode->removeChildNode(currentNode);
2368 if ((dirty & QQuickItemPrivate::Size) && itemPriv->clipNode()) {
2369 itemPriv->clipNode()->setRect(item->clipRect());
2370 itemPriv->clipNode()->update();
2373 if (dirty & (QQuickItemPrivate::OpacityValue | QQuickItemPrivate::Visible
2374 | QQuickItemPrivate::HideReference | QQuickItemPrivate::Window))
2376 qreal opacity = itemPriv->explicitVisible && (!itemPriv->extra.isAllocated() || itemPriv->extra->hideRefCount == 0)
2377 ? itemPriv->opacity() : qreal(0);
2379 if (opacity != 1 && !itemPriv->opacityNode()) {
2380 QSGOpacityNode *node =
new QSGOpacityNode;
2381 itemPriv->extra.value().opacityNode = node;
2383 QSGNode *parent = itemPriv->itemNode();
2384 QSGNode *child = itemPriv->clipNode();
2386 child = itemPriv->rootNode();
2389 parent->removeChildNode(child);
2390 node->appendChildNode(child);
2391 parent->appendChildNode(node);
2393 parent->reparentChildNodesTo(node);
2394 parent->appendChildNode(node);
2397 if (itemPriv->opacityNode())
2398 itemPriv->opacityNode()->setOpacity(opacity);
2401 if (dirty & QQuickItemPrivate::ContentUpdateMask) {
2403 if (itemPriv->flags & QQuickItem::ItemHasContents) {
2404 updatePaintNodeData.transformNode = itemPriv->itemNode();
2405 itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData);
2407 Q_ASSERT(itemPriv->paintNode ==
nullptr ||
2408 itemPriv->paintNode->parent() ==
nullptr ||
2409 itemPriv->paintNode->parent() == itemPriv->childContainerNode());
2411 if (itemPriv->paintNode && itemPriv->paintNode->parent() ==
nullptr) {
2412 QSGNode *before = qquickitem_before_paintNode(itemPriv);
2413 if (before && before->parent()) {
2414 Q_ASSERT(before->parent() == itemPriv->childContainerNode());
2415 itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, before);
2417 itemPriv->childContainerNode()->prependChildNode(itemPriv->paintNode);
2420 }
else if (itemPriv->paintNode) {
2421 delete itemPriv->paintNode;
2422 itemPriv->paintNode =
nullptr;
2429 QList<QSGNode *> nodes;
2430 nodes << itemPriv->itemNodeInstance
2431 << itemPriv->opacityNode()
2432 << itemPriv->clipNode()
2433 << itemPriv->rootNode()
2434 << itemPriv->paintNode;
2435 nodes.removeAll(
nullptr);
2437 Q_ASSERT(nodes.constFirst() == itemPriv->itemNodeInstance);
2438 for (
int i=1; i<nodes.size(); ++i) {
2439 QSGNode *n = nodes.at(i);
2441 Q_ASSERT(n->parent() == nodes.at(i-1));
2443 Q_ASSERT(n == itemPriv->paintNode || n == itemPriv->childContainerNode() || n->childCount() == 1);