void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller) { QQuickAnimatorJob::initialize(controller); QQuickItemPrivate *d = QQuickItemPrivate::get(m_target); if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } m_opacityNode = d->opacityNode(); if (!m_opacityNode) { m_opacityNode = new QSGOpacityNode(); d->extra.value().opacityNode = m_opacityNode; QSGNode *child = d->clipNode(); if (!child) child = d->rootNode(); if (!child) child = d->groupNode; if (child) { if (child->parent()) child->parent()->removeChildNode(child); m_opacityNode->appendChildNode(child); } d->itemNode()->appendChildNode(m_opacityNode); } }
QSGNode *QuickSceneGraphModel::currentRootNode() const { if (!m_window) return nullptr; QQuickItem *item = m_window->contentItem(); QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item); QSGNode *root = itemPriv->itemNode(); while (root->parent()) // Ensure that we really get the very root node. root = root->parent(); return root; }
void QuickSceneGraphModel::setWindow(QQuickWindow* window) { beginResetModel(); clear(); m_window = window; QQuickItem *item = window->contentItem(); QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item); m_rootNode = itemPriv->itemNode(); while(m_rootNode->parent()) // Ensure that we really get the very root node. m_rootNode = m_rootNode->parent(); updateSGTree(); connect(window, SIGNAL(beforeRendering()), this, SLOT(updateSGTree())); endResetModel(); }
void QuickSceneGraphModel::updateSGTree() { QQuickItem *item = m_window->contentItem(); QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item); QSGNode *rootNode = itemPriv->itemNode(); while(rootNode->parent()) // Ensure that we really get the very root node. rootNode = rootNode->parent(); m_oldChildParentMap = m_childParentMap; m_oldParentChildMap = m_parentChildMap; m_childParentMap = QHash<QSGNode*, QSGNode*>(); m_parentChildMap = QHash<QSGNode*, QVector<QSGNode*> >(); m_childParentMap[m_rootNode] = 0; m_parentChildMap[0].append(m_rootNode); populateFromNode(m_rootNode); collectItemNodes(m_window->contentItem()); }
void QQuickTransformAnimatorJob::Helper::sync() { const quint32 mask = QQuickItemPrivate::Position | QQuickItemPrivate::BasicTransform | QQuickItemPrivate::TransformOrigin | QQuickItemPrivate::Size; QQuickItemPrivate *d = QQuickItemPrivate::get(item); if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } quint32 dirty = mask & d->dirtyAttributes; if (!wasSynced) { dirty = 0xffffffffu; wasSynced = true; } if (dirty == 0) return; node = d->itemNode(); if (dirty & QQuickItemPrivate::Position) { dx = item->x(); dy = item->y(); } if (dirty & QQuickItemPrivate::BasicTransform) { scale = item->scale(); rotation = item->rotation(); } if (dirty & (QQuickItemPrivate::TransformOrigin | QQuickItemPrivate::Size)) { QPointF o = item->transformOriginPoint(); ox = o.x(); oy = o.y(); } }