void QmlAnchorBindingProxy::setVerticalTarget(const QVariant &target) { QmlItemNode newTarget(target.value<ModelNode>()); if (newTarget == m_verticalTarget) return; RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction(); m_verticalTarget = newTarget; m_fxItemNode.anchors().setAnchor(AnchorLine::VerticalCenter, m_verticalTarget, AnchorLine::VerticalCenter); emit verticalTargetChanged(); }
void QmlAnchorBindingProxy::setVerticalTarget(const QString &target) { if (m_ignoreQml) return; QmlItemNode newTarget(targetIdToNode(target)); if (newTarget == m_verticalTarget) return; if (!newTarget.isValid()) return; RewriterTransaction transaction = beginRewriterTransaction( QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget")); m_verticalTarget = newTarget; anchorVertical(); emit verticalTargetChanged(); }
void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode) { m_fxItemNode = fxItemNode; m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_fxItemNode.modelNode().parentProperty().parentModelNode(); if (topAnchored()) { ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode(); if (targetNode.isValid()) m_topTarget = targetNode; } if (bottomAnchored()) { ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Bottom).qmlItemNode(); if (targetNode.isValid()) m_bottomTarget = targetNode; } if (leftAnchored()) { ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Left).qmlItemNode(); if (targetNode.isValid()) m_leftTarget = targetNode; } if (rightAnchored()) { ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Right).qmlItemNode(); if (targetNode.isValid()) m_rightTarget = targetNode; } if (verticalCentered()) { ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode(); if (targetNode.isValid()) m_verticalTarget = targetNode; } if (horizontalCentered()) { ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode(); if (targetNode.isValid()) m_horizontalTarget = targetNode; } emit itemNodeChanged(); emit parentChanged(); emit topAnchorChanged(); emit bottomAnchorChanged(); emit leftAnchorChanged(); emit rightAnchorChanged(); emit centeredHChanged(); emit centeredVChanged(); emit anchorsChanged(); if (m_fxItemNode.hasNodeParent()) { emit itemNodeChanged(); emit topTargetChanged(); emit bottomTargetChanged(); emit leftTargetChanged(); emit rightTargetChanged(); emit verticalTargetChanged(); emit horizontalTargetChanged(); } }