diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-06-09 03:50:51 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-06-09 03:50:51 (GMT) |
commit | 60e291e39040fa4d59a646427dcea8ddf108bf5c (patch) | |
tree | 8888b8cbead32d4c8ff35c17ebaf883424f61e61 /src/declarative/fx/qfxanchors.cpp | |
parent | 991b41aa407b5a8740e6899a3efdc724276dcb95 (diff) | |
download | Qt-60e291e39040fa4d59a646427dcea8ddf108bf5c.zip Qt-60e291e39040fa4d59a646427dcea8ddf108bf5c.tar.gz Qt-60e291e39040fa4d59a646427dcea8ddf108bf5c.tar.bz2 |
Warn when trying to anchor to non-sibling/non-parent.
Diffstat (limited to 'src/declarative/fx/qfxanchors.cpp')
-rw-r--r-- | src/declarative/fx/qfxanchors.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index bd5520a..09d6178 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -325,6 +325,10 @@ QFxItem *QFxAnchors::fill() const void QFxAnchors::setFill(QFxItem *f) { Q_D(QFxAnchors); + if (f != d->item->itemParent() && f->itemParent() != d->item->itemParent()){ + qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling."; + return; + } d->remDepend(d->fill); d->fill = f; d->addDepend(d->fill); @@ -847,7 +851,10 @@ bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) { qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge."; return false; - }else if (anchor.item == item){ + } else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){ + qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling."; + return false; + } else if (anchor.item == item){ qmlInfo(item) << "Can't anchor item to self."; return false; } @@ -878,7 +885,10 @@ bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) { qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge."; return false; - }else if (anchor.item == item){ + } else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){ + qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling."; + return false; + } else if (anchor.item == item){ qmlInfo(item) << "Can't anchor item to self."; return false; } |