From 29cad9b72fb96b3e66bcbbc0d4db28fe26842598 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 30 Apr 2010 18:03:30 +1000 Subject: Don't create an anchors element so that we can check that there aren't any --- .../graphicsitems/qdeclarativepositioners.cpp | 48 ++++++++++++++-------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 3f1d2ac..c1ef04d 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -443,12 +443,15 @@ void QDeclarativeColumn::reportConflictingAnchors() for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (child.item) { - QDeclarativeAnchors::Anchors usedAnchors = QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors(); - if (usedAnchors & QDeclarativeAnchors::TopAnchor || - usedAnchors & QDeclarativeAnchors::BottomAnchor || - usedAnchors & QDeclarativeAnchors::VCenterAnchor) { - childsWithConflictingAnchors = true; - break; + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (anchors) { + QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors(); + if (usedAnchors & QDeclarativeAnchors::TopAnchor || + usedAnchors & QDeclarativeAnchors::BottomAnchor || + usedAnchors & QDeclarativeAnchors::VCenterAnchor) { + childsWithConflictingAnchors = true; + break; + } } } } @@ -578,12 +581,15 @@ void QDeclarativeRow::reportConflictingAnchors() for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (child.item) { - QDeclarativeAnchors::Anchors usedAnchors = QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors(); - if (usedAnchors & QDeclarativeAnchors::LeftAnchor || - usedAnchors & QDeclarativeAnchors::RightAnchor || - usedAnchors & QDeclarativeAnchors::HCenterAnchor) { - childsWithConflictingAnchors = true; - break; + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (anchors) { + QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors(); + if (usedAnchors & QDeclarativeAnchors::LeftAnchor || + usedAnchors & QDeclarativeAnchors::RightAnchor || + usedAnchors & QDeclarativeAnchors::HCenterAnchor) { + childsWithConflictingAnchors = true; + break; + } } } } @@ -868,9 +874,12 @@ void QDeclarativeGrid::reportConflictingAnchors() bool childsWithConflictingAnchors(false); for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (child.item && QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors()) { - childsWithConflictingAnchors = true; - break; + if (child.item) { + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (anchors && anchors->usedAnchors()) { + childsWithConflictingAnchors = true; + break; + } } } if (childsWithConflictingAnchors) { @@ -1025,9 +1034,12 @@ void QDeclarativeFlow::reportConflictingAnchors() bool childsWithConflictingAnchors(false); for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (child.item && QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors()) { - childsWithConflictingAnchors = true; - break; + if (child.item) { + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (anchors && anchors->usedAnchors()) { + childsWithConflictingAnchors = true; + break; + } } } if (childsWithConflictingAnchors) { -- cgit v0.12