void QmlAnchorBindingProxy::fill() { RewriterTransaction transaction = beginRewriterTransaction( QByteArrayLiteral("QmlAnchorBindingProxy::fill")); backupPropertyAndRemove(modelNode(), "x"); backupPropertyAndRemove(modelNode(), "y"); backupPropertyAndRemove(modelNode(), "width"); backupPropertyAndRemove(modelNode(), "height"); m_qmlItemNode.anchors().fill(); setHorizontalCentered(false); setVerticalCentered(false); m_qmlItemNode.anchors().removeMargin(AnchorLineRight); m_qmlItemNode.anchors().removeMargin(AnchorLineLeft); m_qmlItemNode.anchors().removeMargin(AnchorLineTop); m_qmlItemNode.anchors().removeMargin(AnchorLineBottom); emit topAnchorChanged(); emit bottomAnchorChanged(); emit leftAnchorChanged(); emit rightAnchorChanged(); emit anchorsChanged(); }
void QmlAnchorBindingProxy::setRightAnchor(bool anchor) { if (!m_qmlItemNode.hasNodeParent()) return; if (rightAnchored() == anchor) return; RewriterTransaction transaction = beginRewriterTransaction( QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor")); if (!anchor) { removeRightAnchor(); } else { setDefaultRelativeRightTarget(); anchorRight(); if (leftAnchored()) backupPropertyAndRemove(modelNode(), "width"); } emit relativeAnchorTargetRightChanged(); emit rightAnchorChanged(); if (hasAnchors() != anchor) emit anchorsChanged(); }
void QmlAnchorBindingProxy::fill() { RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction(); backupPropertyAndRemove(modelNode(), "x"); backupPropertyAndRemove(modelNode(), "y"); backupPropertyAndRemove(modelNode(), "width"); backupPropertyAndRemove(modelNode(), "height"); m_fxItemNode.anchors().fill(); setHorizontalCentered(false); setVerticalCentered(false); m_fxItemNode.anchors().removeMargin(AnchorLine::Right); m_fxItemNode.anchors().removeMargin(AnchorLine::Left); m_fxItemNode.anchors().removeMargin(AnchorLine::Top); m_fxItemNode.anchors().removeMargin(AnchorLine::Bottom); emit topAnchorChanged(); emit bottomAnchorChanged(); emit leftAnchorChanged(); emit rightAnchorChanged(); emit anchorsChanged(); }
void QmlAnchorBindingProxy::resetLayout() { RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction(); m_fxItemNode.anchors().removeAnchors(); m_fxItemNode.anchors().removeMargins(); restoreProperty(modelNode(), "x"); restoreProperty(modelNode(), "y"); restoreProperty(modelNode(), "width"); restoreProperty(modelNode(), "height"); emit topAnchorChanged(); emit bottomAnchorChanged(); emit leftAnchorChanged(); emit rightAnchorChanged(); emit anchorsChanged(); }
void QmlAnchorBindingProxy::resetLayout() { RewriterTransaction transaction = beginRewriterTransaction( QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout")); m_qmlItemNode.anchors().removeAnchors(); m_qmlItemNode.anchors().removeMargins(); restoreProperty(modelNode(), "x"); restoreProperty(modelNode(), "y"); restoreProperty(modelNode(), "width"); restoreProperty(modelNode(), "height"); emit topAnchorChanged(); emit bottomAnchorChanged(); emit leftAnchorChanged(); emit rightAnchorChanged(); emit anchorsChanged(); }
void QmlAnchorBindingProxy::setRightAnchor(bool anchor) { if (!m_qmlItemNode.hasNodeParent()) return; if (rightAnchored() == anchor) return; RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor")); if (!anchor) { removeRightAnchor(); } else { calcRightMargin(); if (leftAnchored()) backupPropertyAndRemove(modelNode(), "width"); } emit rightAnchorChanged(); if (hasAnchors() != anchor) emit anchorsChanged(); }
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(); } }