Commit b24b27f4 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.PropertyEditor: Fixing coding style



Change-Id: Ifc0e17d5d34d6c69b201d8fc03d444a89e146ac0
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent eab3a5eb
......@@ -114,7 +114,13 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode)
m_ignoreQml = true;
m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_qmlItemNode.modelNode().parentProperty().parentModelNode();
m_verticalTarget =
m_horizontalTarget =
m_topTarget =
m_bottomTarget =
m_leftTarget =
m_rightTarget =
m_qmlItemNode.modelNode().parentProperty().parentModelNode();
setupAnchorTargets();
......@@ -283,6 +289,11 @@ void QmlAnchorBindingProxy::setDefaultRelativeRightTarget()
}
}
RewriterTransaction QmlAnchorBindingProxy::beginRewriterTransaction(const QByteArray &identifier)
{
return m_qmlItemNode.modelNode().view()->beginRewriterTransaction(identifier);
}
bool QmlAnchorBindingProxy::hasParent()
{
return m_qmlItemNode.isValid() && m_qmlItemNode.hasNodeParent();
......@@ -290,7 +301,12 @@ bool QmlAnchorBindingProxy::hasParent()
bool QmlAnchorBindingProxy::isFilled()
{
return m_qmlItemNode.isValid() && hasAnchors() && topAnchored() && bottomAnchored() && leftAnchored() && rightAnchored()
return m_qmlItemNode.isValid()
&& hasAnchors()
&& topAnchored()
&& bottomAnchored()
&& leftAnchored()
&& rightAnchored()
&& (m_qmlItemNode.instanceValue("anchors.topMargin").toInt() == 0)
&& (m_qmlItemNode.instanceValue("anchors.bottomMargin").toInt() == 0)
&& (m_qmlItemNode.instanceValue("anchors.leftMargin").toInt() == 0)
......@@ -337,7 +353,8 @@ void QmlAnchorBindingProxy::setTopTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setTopTarget"));
m_topTarget = newTarget;
......@@ -362,7 +379,8 @@ void QmlAnchorBindingProxy::setBottomTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setBottomTarget"));
m_bottomTarget = newTarget;
setDefaultRelativeBottomTarget();
......@@ -384,7 +402,8 @@ void QmlAnchorBindingProxy::setLeftTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setLeftTarget"));
m_leftTarget = newTarget;
setDefaultRelativeLeftTarget();
......@@ -406,7 +425,8 @@ void QmlAnchorBindingProxy::setRightTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRightTarget"));
m_rightTarget = newTarget;
setDefaultRelativeRightTarget();
......@@ -428,7 +448,8 @@ void QmlAnchorBindingProxy::setVerticalTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalTarget"));
m_verticalTarget = newTarget;
anchorVertical();
......@@ -449,7 +470,8 @@ void QmlAnchorBindingProxy::setHorizontalTarget(const QString &target)
if (!newTarget.isValid())
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalTarget"));
m_horizontalTarget = newTarget;
anchorHorizontal();
......@@ -465,7 +487,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetTop(QmlAnchorBindingProxy::Re
if (target == m_relativeTopTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetTop"));
m_relativeTopTarget = target;
......@@ -482,7 +505,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetBottom(QmlAnchorBindingProxy:
if (target == m_relativeBottomTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetBottom"));
m_relativeBottomTarget = target;
......@@ -499,7 +523,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetLeft(QmlAnchorBindingProxy::R
if (target == m_relativeLeftTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetLeft"));
m_relativeLeftTarget = target;
......@@ -516,7 +541,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetRight(QmlAnchorBindingProxy::
if (target == m_relativeRightTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetRight"));
m_relativeRightTarget = target;
......@@ -534,7 +560,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetVertical(QmlAnchorBindingProx
if (target == m_relativeVerticalTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetVertical"));
m_relativeVerticalTarget = target;
......@@ -551,7 +578,8 @@ void QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal(QmlAnchorBindingPr
if (target == m_relativeHorizontalTarget)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRelativeAnchorTargetHorizontal"));
m_relativeHorizontalTarget = target;
......@@ -601,7 +629,8 @@ int QmlAnchorBindingProxy::indexOfPossibleTargetItem(const QString &targetName)
}
void QmlAnchorBindingProxy::resetLayout() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::resetLayout"));
m_qmlItemNode.anchors().removeAnchors();
m_qmlItemNode.anchors().removeMargins();
......@@ -626,7 +655,8 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
if (bottomAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setBottomAnchor"));
if (!anchor) {
removeBottomAnchor();
......@@ -652,7 +682,8 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
if (leftAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setLeftAnchor"));
if (!anchor) {
removeLeftAnchor();
......@@ -679,7 +710,8 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
if (rightAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setRightAnchor"));
if (!anchor) {
removeRightAnchor();
......@@ -868,7 +900,8 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
if (topAnchored() == anchor)
return;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setTopAnchor"));
if (!anchor) {
removeTopAnchor();
......@@ -888,7 +921,8 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
}
void QmlAnchorBindingProxy::removeTopAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeTopAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeTopAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineTop);
m_qmlItemNode.anchors().removeMargin(AnchorLineTop);
......@@ -899,7 +933,8 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
}
void QmlAnchorBindingProxy::removeBottomAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeBottomAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeBottomAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineBottom);
m_qmlItemNode.anchors().removeMargin(AnchorLineBottom);
......@@ -909,7 +944,8 @@ void QmlAnchorBindingProxy::removeBottomAnchor() {
}
void QmlAnchorBindingProxy::removeLeftAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeLeftAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeLeftAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineLeft);
m_qmlItemNode.anchors().removeMargin(AnchorLineLeft);
......@@ -919,7 +955,8 @@ void QmlAnchorBindingProxy::removeLeftAnchor() {
}
void QmlAnchorBindingProxy::removeRightAnchor() {
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::removeRightAnchor"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::removeRightAnchor"));
m_qmlItemNode.anchors().removeAnchor(AnchorLineRight);
m_qmlItemNode.anchors().removeMargin(AnchorLineRight);
......@@ -937,7 +974,8 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
m_locked = true;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setVerticalCentered"));
if (!centered) {
m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter);
......@@ -964,7 +1002,8 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
m_locked = true;
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::setHorizontalCentered"));
if (!centered) {
m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter);
......@@ -1054,7 +1093,8 @@ bool QmlAnchorBindingProxy::horizontalCentered()
void QmlAnchorBindingProxy::fill()
{
RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction(QByteArrayLiteral("QmlAnchorBindingProxy::fill"));
RewriterTransaction transaction = beginRewriterTransaction(
QByteArrayLiteral("QmlAnchorBindingProxy::fill"));
backupPropertyAndRemove(modelNode(), "x");
......
......@@ -210,6 +210,7 @@ private:
void setDefaultRelativeLeftTarget();
void setDefaultRelativeRightTarget();
RewriterTransaction beginRewriterTransaction(const QByteArray &identifier);
QmlItemNode targetIdToNode(const QString &id) const;
QString idForNode(const QmlItemNode &qmlItemNode) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment