diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-11-25 04:43:17 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-11-25 04:43:17 (GMT) |
commit | 2106a8453b80e2cdfed77ad3e2881696437d6774 (patch) | |
tree | 283ef8490c3f70c9a1e96b310cf4a35f407c631c /src/declarative | |
parent | 4e8ee5429339ec3c56656858ec7edc8ca726bd5c (diff) | |
parent | 14877e418b3223ab7eacf49523eed2b10ce7721b (diff) | |
download | Qt-2106a8453b80e2cdfed77ad3e2881696437d6774.zip Qt-2106a8453b80e2cdfed77ad3e2881696437d6774.tar.gz Qt-2106a8453b80e2cdfed77ad3e2881696437d6774.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors.cpp | 39 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors_p.h | 27 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h | 7 | ||||
-rw-r--r-- | src/declarative/util/qmlstategroup.cpp | 4 |
4 files changed, 57 insertions, 20 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(); } diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h index bdddafe..e432428 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h @@ -58,13 +58,13 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject { Q_OBJECT - Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft RESET resetLeft) - Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight RESET resetRight) - Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter) - Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop RESET resetTop) - Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom) - Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) - Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline) + Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged) + Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged) + Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged) + Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged) + Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged) + Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged) + Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline NOTIFY baselineChanged) Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged) Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged) Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged()) @@ -72,8 +72,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged) Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged()) Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged()) - Q_PROPERTY(QmlGraphicsItem *fill READ fill WRITE setFill) - Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn) + Q_PROPERTY(QmlGraphicsItem *fill READ fill WRITE setFill NOTIFY fillChanged) + Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn NOTIFY centerInChanged) public: QmlGraphicsAnchors(QObject *parent=0); @@ -155,6 +155,15 @@ public: void componentComplete(); Q_SIGNALS: + void leftChanged(); + void rightChanged(); + void topChanged(); + void bottomChanged(); + void verticalCenterChanged(); + void horizontalCenterChanged(); + void baselineChanged(); + void fillChanged(); + void centerInChanged(); void leftMarginChanged(); void rightMarginChanged(); void topMarginChanged(); diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h index d21d9c5..2156565 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h @@ -80,9 +80,16 @@ public: QmlGraphicsItem *item; AnchorLine anchorLine; + + bool operator==(const QmlGraphicsAnchorLine& other) const + { + return item == other.item && anchorLine == other.anchorLine; + } }; Q_DECLARE_METATYPE(QmlGraphicsAnchorLine) + + class QmlGraphicsAnchorsPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlGraphicsAnchors) diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index 4dfa34a..f206f5c 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -331,8 +331,10 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state, bool ignoreTrans) { Q_Q(QmlStateGroup); - if (!componentComplete) + if (!componentComplete) { + currentState = state; return; + } if (applyingState) { qWarning() << "Can't apply a state change as part of a state definition."; |