diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-22 07:46:57 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-12-22 07:46:57 (GMT) |
commit | 944a9b41e34e0a8c9b9994a040a6b83aa4e11291 (patch) | |
tree | c1f165036182ae2236f787d38913991b6e9e9cf0 | |
parent | ad718beb09ec9d4ce2a52712c098185f15eee5e9 (diff) | |
download | Qt-944a9b41e34e0a8c9b9994a040a6b83aa4e11291.zip Qt-944a9b41e34e0a8c9b9994a040a6b83aa4e11291.tar.gz Qt-944a9b41e34e0a8c9b9994a040a6b83aa4e11291.tar.bz2 |
Minor optimizations
4 files changed, 7 insertions, 16 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp index c2e1fa2..ddf2a3b 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,Anchors,QmlGraphicsAnchors) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsAnchors) //TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)? //TODO: support non-parent, non-sibling (need to find lowest common ancestor) @@ -131,8 +131,8 @@ static qreal adjustedPosition(QmlGraphicsItem *item, QmlGraphicsAnchorLine::Anch \warning Currently, only anchoring to siblings or parent is supported. */ -QmlGraphicsAnchors::QmlGraphicsAnchors(QObject *parent) - : QObject(*new QmlGraphicsAnchorsPrivate(), parent) +QmlGraphicsAnchors::QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent) + : QObject(*new QmlGraphicsAnchorsPrivate(item), parent) { } @@ -980,12 +980,6 @@ QmlGraphicsAnchors::UsedAnchors QmlGraphicsAnchors::usedAnchors() const return d->usedAnchors; } -void QmlGraphicsAnchors::setItem(QmlGraphicsItem *item) -{ - Q_D(QmlGraphicsAnchors); - d->item = item; -} - bool QmlGraphicsAnchorsPrivate::checkHValid() const { if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor && diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h index a67a9f8..dc6a7a8 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h @@ -79,7 +79,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) public: - QmlGraphicsAnchors(QObject *parent=0); + QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent=0); virtual ~QmlGraphicsAnchors(); enum UsedAnchor { @@ -157,8 +157,6 @@ public: UsedAnchors usedAnchors() const; - void setItem(QmlGraphicsItem *item); - void classBegin(); void componentComplete(); diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h index 45c983f..5b02158 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h @@ -95,9 +95,9 @@ class QmlGraphicsAnchorsPrivate : public QObjectPrivate, public QmlGraphicsItemC { Q_DECLARE_PUBLIC(QmlGraphicsAnchors) public: - QmlGraphicsAnchorsPrivate() + QmlGraphicsAnchorsPrivate(QmlGraphicsItem *i) : updatingMe(false), updatingHorizontalAnchor(0), - updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(0), usedAnchors(0), fill(0), + updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0), centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0), margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0), componentComplete(true) diff --git a/src/declarative/graphicsitems/qmlgraphicsitem_p.h b/src/declarative/graphicsitems/qmlgraphicsitem_p.h index d5dbe1d..ca850f3 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsitem_p.h @@ -173,8 +173,7 @@ public: QmlGraphicsAnchors *anchors() { if (!_anchors) { Q_Q(QmlGraphicsItem); - _anchors = new QmlGraphicsAnchors; - _anchors->setItem(q); + _anchors = new QmlGraphicsAnchors(q); if (!_componentComplete) _anchors->classBegin(); } |