summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicsanchors.cpp')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
index 61b6ecc..f26fbf5 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
@@ -349,6 +349,9 @@ QmlGraphicsItem *QmlGraphicsAnchors::fill() const
void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f)
{
Q_D(QmlGraphicsAnchors);
+ if (d->fill == f)
+ return;
+
if (!f) {
d->remDepend(d->fill);
d->fill = f;
@@ -361,7 +364,7 @@ void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f)
d->remDepend(d->fill);
d->fill = f;
d->addDepend(d->fill);
-
+ emit fillChanged();
d->fillChanged();
}
@@ -374,6 +377,9 @@ QmlGraphicsItem *QmlGraphicsAnchors::centerIn() const
void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c)
{
Q_D(QmlGraphicsAnchors);
+ if (d->centerIn == c)
+ return;
+
if (!c) {
d->remDepend(d->centerIn);
d->centerIn = c;
@@ -387,7 +393,7 @@ void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c)
d->remDepend(d->centerIn);
d->centerIn = c;
d->addDepend(d->centerIn);
-
+ emit centerInChanged();
d->centerInChanged();
}
@@ -553,7 +559,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::top() const
void QmlGraphicsAnchors::setTop(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkVAnchorValid(edge))
+ if (!d->checkVAnchorValid(edge) || d->top == edge)
return;
d->usedAnchors |= HasTopAnchor;
@@ -566,6 +572,7 @@ void QmlGraphicsAnchors::setTop(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->top.item);
d->top = edge;
d->addDepend(d->top.item);
+ emit topChanged();
d->updateVerticalAnchors();
}
@@ -575,6 +582,7 @@ void QmlGraphicsAnchors::resetTop()
d->usedAnchors &= ~HasTopAnchor;
d->remDepend(d->top.item);
d->top = QmlGraphicsAnchorLine();
+ emit topChanged();
d->updateVerticalAnchors();
}
@@ -587,7 +595,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::bottom() const
void QmlGraphicsAnchors::setBottom(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkVAnchorValid(edge))
+ if (!d->checkVAnchorValid(edge) || d->bottom == edge)
return;
d->usedAnchors |= HasBottomAnchor;
@@ -600,6 +608,7 @@ void QmlGraphicsAnchors::setBottom(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->bottom.item);
d->bottom = edge;
d->addDepend(d->bottom.item);
+ emit bottomChanged();
d->updateVerticalAnchors();
}
@@ -609,6 +618,7 @@ void QmlGraphicsAnchors::resetBottom()
d->usedAnchors &= ~HasBottomAnchor;
d->remDepend(d->bottom.item);
d->bottom = QmlGraphicsAnchorLine();
+ emit bottomChanged();
d->updateVerticalAnchors();
}
@@ -621,7 +631,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::verticalCenter() const
void QmlGraphicsAnchors::setVerticalCenter(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkVAnchorValid(edge))
+ if (!d->checkVAnchorValid(edge) || d->vCenter == edge)
return;
d->usedAnchors |= HasVCenterAnchor;
@@ -634,6 +644,7 @@ void QmlGraphicsAnchors::setVerticalCenter(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->vCenter.item);
d->vCenter = edge;
d->addDepend(d->vCenter.item);
+ emit verticalCenterChanged();
d->updateVerticalAnchors();
}
@@ -643,6 +654,7 @@ void QmlGraphicsAnchors::resetVerticalCenter()
d->usedAnchors &= ~HasVCenterAnchor;
d->remDepend(d->vCenter.item);
d->vCenter = QmlGraphicsAnchorLine();
+ emit verticalCenterChanged();
d->updateVerticalAnchors();
}
@@ -655,7 +667,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::baseline() const
void QmlGraphicsAnchors::setBaseline(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkVAnchorValid(edge))
+ if (!d->checkVAnchorValid(edge) || d->baseline == edge)
return;
d->usedAnchors |= HasBaselineAnchor;
@@ -668,6 +680,7 @@ void QmlGraphicsAnchors::setBaseline(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->baseline.item);
d->baseline = edge;
d->addDepend(d->baseline.item);
+ emit baselineChanged();
d->updateVerticalAnchors();
}
@@ -677,6 +690,7 @@ void QmlGraphicsAnchors::resetBaseline()
d->usedAnchors &= ~HasBaselineAnchor;
d->remDepend(d->baseline.item);
d->baseline = QmlGraphicsAnchorLine();
+ emit baselineChanged();
d->updateVerticalAnchors();
}
@@ -689,7 +703,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::left() const
void QmlGraphicsAnchors::setLeft(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkHAnchorValid(edge))
+ if (!d->checkHAnchorValid(edge) || d->left == edge)
return;
d->usedAnchors |= HasLeftAnchor;
@@ -702,6 +716,7 @@ void QmlGraphicsAnchors::setLeft(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->left.item);
d->left = edge;
d->addDepend(d->left.item);
+ emit leftChanged();
d->updateHorizontalAnchors();
}
@@ -711,6 +726,7 @@ void QmlGraphicsAnchors::resetLeft()
d->usedAnchors &= ~HasLeftAnchor;
d->remDepend(d->left.item);
d->left = QmlGraphicsAnchorLine();
+ emit leftChanged();
d->updateHorizontalAnchors();
}
@@ -723,7 +739,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::right() const
void QmlGraphicsAnchors::setRight(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkHAnchorValid(edge))
+ if (!d->checkHAnchorValid(edge) || d->right == edge)
return;
d->usedAnchors |= HasRightAnchor;
@@ -736,7 +752,7 @@ void QmlGraphicsAnchors::setRight(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->right.item);
d->right = edge;
d->addDepend(d->right.item);
-
+ emit rightChanged();
d->updateHorizontalAnchors();
}
@@ -746,6 +762,7 @@ void QmlGraphicsAnchors::resetRight()
d->usedAnchors &= ~HasRightAnchor;
d->remDepend(d->right.item);
d->right = QmlGraphicsAnchorLine();
+ emit rightChanged();
d->updateHorizontalAnchors();
}
@@ -758,7 +775,7 @@ QmlGraphicsAnchorLine QmlGraphicsAnchors::horizontalCenter() const
void QmlGraphicsAnchors::setHorizontalCenter(const QmlGraphicsAnchorLine &edge)
{
Q_D(QmlGraphicsAnchors);
- if (!d->checkHAnchorValid(edge))
+ if (!d->checkHAnchorValid(edge) || d->hCenter == edge)
return;
d->usedAnchors |= HasHCenterAnchor;
@@ -771,6 +788,7 @@ void QmlGraphicsAnchors::setHorizontalCenter(const QmlGraphicsAnchorLine &edge)
d->remDepend(d->hCenter.item);
d->hCenter = edge;
d->addDepend(d->hCenter.item);
+ emit horizontalCenterChanged();
d->updateHorizontalAnchors();
}
@@ -780,6 +798,7 @@ void QmlGraphicsAnchors::resetHorizontalCenter()
d->usedAnchors &= ~HasHCenterAnchor;
d->remDepend(d->hCenter.item);
d->hCenter = QmlGraphicsAnchorLine();
+ emit horizontalCenterChanged();
d->updateHorizontalAnchors();
}