summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeanchors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeanchors.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp
index 96d0867..f15316b 100644
--- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp
@@ -221,31 +221,31 @@ void QDeclarativeAnchorsPrivate::clearItem(QGraphicsObject *item)
centerIn = 0;
if (left.item == item) {
left.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasLeftAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::LeftAnchor;
}
if (right.item == item) {
right.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasRightAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::RightAnchor;
}
if (top.item == item) {
top.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasTopAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::TopAnchor;
}
if (bottom.item == item) {
bottom.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasBottomAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::BottomAnchor;
}
if (vCenter.item == item) {
vCenter.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasVCenterAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::VCenterAnchor;
}
if (hCenter.item == item) {
hCenter.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasHCenterAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HCenterAnchor;
}
if (baseline.item == item) {
baseline.item = 0;
- usedAnchors &= ~QDeclarativeAnchors::HasBaselineAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::BaselineAnchor;
}
}
@@ -495,13 +495,13 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors()
if (updatingVerticalAnchor < 2) {
++updatingVerticalAnchor;
QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item);
- if (usedAnchors & QDeclarativeAnchors::HasTopAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::TopAnchor) {
//Handle stretching
bool invalid = true;
int height = 0;
- if (usedAnchors & QDeclarativeAnchors::HasBottomAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::BottomAnchor) {
invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QDeclarativeAnchorLine::Top, height);
- } else if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::VCenterAnchor) {
invalid = calcStretch(top, vCenter, topMargin, vCenterOffset, QDeclarativeAnchorLine::Top, height);
height *= 2;
}
@@ -514,9 +514,9 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors()
} else if (top.item->parentItem() == item->parentItem()) {
setItemY(position(top.item, top.anchorLine) + topMargin);
}
- } else if (usedAnchors & QDeclarativeAnchors::HasBottomAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::BottomAnchor) {
//Handle stretching (top + bottom case is handled above)
- if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::VCenterAnchor) {
int height = 0;
bool invalid = calcStretch(vCenter, bottom, vCenterOffset, -bottomMargin,
QDeclarativeAnchorLine::Top, height);
@@ -530,7 +530,7 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors()
} else if (bottom.item->parentItem() == item->parentItem()) {
setItemY(position(bottom.item, bottom.anchorLine) - itemPrivate->height() - bottomMargin);
}
- } else if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::VCenterAnchor) {
//(stetching handled above)
//Handle vCenter
@@ -540,7 +540,7 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors()
} else if (vCenter.item->parentItem() == item->parentItem()) {
setItemY(position(vCenter.item, vCenter.anchorLine) - itemPrivate->height()/2 + vCenterOffset);
}
- } else if (usedAnchors & QDeclarativeAnchors::HasBaselineAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::BaselineAnchor) {
//Handle baseline
if (baseline.item == item->parentItem()) {
if (itemPrivate->isDeclarativeItem)
@@ -567,13 +567,13 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors()
if (updatingHorizontalAnchor < 2) {
++updatingHorizontalAnchor;
QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item);
- if (usedAnchors & QDeclarativeAnchors::HasLeftAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::LeftAnchor) {
//Handle stretching
bool invalid = true;
int width = 0;
- if (usedAnchors & QDeclarativeAnchors::HasRightAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::RightAnchor) {
invalid = calcStretch(left, right, leftMargin, -rightMargin, QDeclarativeAnchorLine::Left, width);
- } else if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) {
invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QDeclarativeAnchorLine::Left, width);
width *= 2;
}
@@ -586,9 +586,9 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors()
} else if (left.item->parentItem() == item->parentItem()) {
setItemX(position(left.item, left.anchorLine) + leftMargin);
}
- } else if (usedAnchors & QDeclarativeAnchors::HasRightAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::RightAnchor) {
//Handle stretching (left + right case is handled in updateLeftAnchor)
- if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) {
int width = 0;
bool invalid = calcStretch(hCenter, right, hCenterOffset, -rightMargin,
QDeclarativeAnchorLine::Left, width);
@@ -602,7 +602,7 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors()
} else if (right.item->parentItem() == item->parentItem()) {
setItemX(position(right.item, right.anchorLine) - itemPrivate->width() - rightMargin);
}
- } else if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) {
//Handle hCenter
if (hCenter.item == item->parentItem()) {
setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - itemPrivate->width()/2 + hCenterOffset);
@@ -630,10 +630,10 @@ void QDeclarativeAnchors::setTop(const QDeclarativeAnchorLine &edge)
if (!d->checkVAnchorValid(edge) || d->top == edge)
return;
- d->usedAnchors |= HasTopAnchor;
+ d->usedAnchors |= TopAnchor;
if (!d->checkVValid()) {
- d->usedAnchors &= ~HasTopAnchor;
+ d->usedAnchors &= ~TopAnchor;
return;
}
@@ -647,7 +647,7 @@ void QDeclarativeAnchors::setTop(const QDeclarativeAnchorLine &edge)
void QDeclarativeAnchors::resetTop()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasTopAnchor;
+ d->usedAnchors &= ~TopAnchor;
d->remDepend(d->top.item);
d->top = QDeclarativeAnchorLine();
emit topChanged();
@@ -666,10 +666,10 @@ void QDeclarativeAnchors::setBottom(const QDeclarativeAnchorLine &edge)
if (!d->checkVAnchorValid(edge) || d->bottom == edge)
return;
- d->usedAnchors |= HasBottomAnchor;
+ d->usedAnchors |= BottomAnchor;
if (!d->checkVValid()) {
- d->usedAnchors &= ~HasBottomAnchor;
+ d->usedAnchors &= ~BottomAnchor;
return;
}
@@ -683,7 +683,7 @@ void QDeclarativeAnchors::setBottom(const QDeclarativeAnchorLine &edge)
void QDeclarativeAnchors::resetBottom()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasBottomAnchor;
+ d->usedAnchors &= ~BottomAnchor;
d->remDepend(d->bottom.item);
d->bottom = QDeclarativeAnchorLine();
emit bottomChanged();
@@ -702,10 +702,10 @@ void QDeclarativeAnchors::setVerticalCenter(const QDeclarativeAnchorLine &edge)
if (!d->checkVAnchorValid(edge) || d->vCenter == edge)
return;
- d->usedAnchors |= HasVCenterAnchor;
+ d->usedAnchors |= VCenterAnchor;
if (!d->checkVValid()) {
- d->usedAnchors &= ~HasVCenterAnchor;
+ d->usedAnchors &= ~VCenterAnchor;
return;
}
@@ -719,7 +719,7 @@ void QDeclarativeAnchors::setVerticalCenter(const QDeclarativeAnchorLine &edge)
void QDeclarativeAnchors::resetVerticalCenter()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasVCenterAnchor;
+ d->usedAnchors &= ~VCenterAnchor;
d->remDepend(d->vCenter.item);
d->vCenter = QDeclarativeAnchorLine();
emit verticalCenterChanged();
@@ -738,10 +738,10 @@ void QDeclarativeAnchors::setBaseline(const QDeclarativeAnchorLine &edge)
if (!d->checkVAnchorValid(edge) || d->baseline == edge)
return;
- d->usedAnchors |= HasBaselineAnchor;
+ d->usedAnchors |= BaselineAnchor;
if (!d->checkVValid()) {
- d->usedAnchors &= ~HasBaselineAnchor;
+ d->usedAnchors &= ~BaselineAnchor;
return;
}
@@ -755,7 +755,7 @@ void QDeclarativeAnchors::setBaseline(const QDeclarativeAnchorLine &edge)
void QDeclarativeAnchors::resetBaseline()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasBaselineAnchor;
+ d->usedAnchors &= ~BaselineAnchor;
d->remDepend(d->baseline.item);
d->baseline = QDeclarativeAnchorLine();
emit baselineChanged();
@@ -774,10 +774,10 @@ void QDeclarativeAnchors::setLeft(const QDeclarativeAnchorLine &edge)
if (!d->checkHAnchorValid(edge) || d->left == edge)
return;
- d->usedAnchors |= HasLeftAnchor;
+ d->usedAnchors |= LeftAnchor;
if (!d->checkHValid()) {
- d->usedAnchors &= ~HasLeftAnchor;
+ d->usedAnchors &= ~LeftAnchor;
return;
}
@@ -791,7 +791,7 @@ void QDeclarativeAnchors::setLeft(const QDeclarativeAnchorLine &edge)
void QDeclarativeAnchors::resetLeft()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasLeftAnchor;
+ d->usedAnchors &= ~LeftAnchor;
d->remDepend(d->left.item);
d->left = QDeclarativeAnchorLine();
emit leftChanged();
@@ -810,10 +810,10 @@ void QDeclarativeAnchors::setRight(const QDeclarativeAnchorLine &edge)
if (!d->checkHAnchorValid(edge) || d->right == edge)
return;
- d->usedAnchors |= HasRightAnchor;
+ d->usedAnchors |= RightAnchor;
if (!d->checkHValid()) {
- d->usedAnchors &= ~HasRightAnchor;
+ d->usedAnchors &= ~RightAnchor;
return;
}
@@ -827,7 +827,7 @@ void QDeclarativeAnchors::setRight(const QDeclarativeAnchorLine &edge)
void QDeclarativeAnchors::resetRight()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasRightAnchor;
+ d->usedAnchors &= ~RightAnchor;
d->remDepend(d->right.item);
d->right = QDeclarativeAnchorLine();
emit rightChanged();
@@ -846,10 +846,10 @@ void QDeclarativeAnchors::setHorizontalCenter(const QDeclarativeAnchorLine &edge
if (!d->checkHAnchorValid(edge) || d->hCenter == edge)
return;
- d->usedAnchors |= HasHCenterAnchor;
+ d->usedAnchors |= HCenterAnchor;
if (!d->checkHValid()) {
- d->usedAnchors &= ~HasHCenterAnchor;
+ d->usedAnchors &= ~HCenterAnchor;
return;
}
@@ -863,7 +863,7 @@ void QDeclarativeAnchors::setHorizontalCenter(const QDeclarativeAnchorLine &edge
void QDeclarativeAnchors::resetHorizontalCenter()
{
Q_D(QDeclarativeAnchors);
- d->usedAnchors &= ~HasHCenterAnchor;
+ d->usedAnchors &= ~HCenterAnchor;
d->remDepend(d->hCenter.item);
d->hCenter = QDeclarativeAnchorLine();
emit horizontalCenterChanged();
@@ -1025,7 +1025,7 @@ void QDeclarativeAnchors::setBaselineOffset(qreal offset)
emit baselineOffsetChanged();
}
-QDeclarativeAnchors::UsedAnchors QDeclarativeAnchors::usedAnchors() const
+QDeclarativeAnchors::Anchors QDeclarativeAnchors::usedAnchors() const
{
Q_D(const QDeclarativeAnchors);
return d->usedAnchors;
@@ -1033,9 +1033,9 @@ QDeclarativeAnchors::UsedAnchors QDeclarativeAnchors::usedAnchors() const
bool QDeclarativeAnchorsPrivate::checkHValid() const
{
- if (usedAnchors & QDeclarativeAnchors::HasLeftAnchor &&
- usedAnchors & QDeclarativeAnchors::HasRightAnchor &&
- usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::LeftAnchor &&
+ usedAnchors & QDeclarativeAnchors::RightAnchor &&
+ usedAnchors & QDeclarativeAnchors::HCenterAnchor) {
qmlInfo(item) << QDeclarativeAnchors::tr("Cannot specify left, right, and hcenter anchors.");
return false;
}
@@ -1064,15 +1064,15 @@ bool QDeclarativeAnchorsPrivate::checkHAnchorValid(QDeclarativeAnchorLine anchor
bool QDeclarativeAnchorsPrivate::checkVValid() const
{
- if (usedAnchors & QDeclarativeAnchors::HasTopAnchor &&
- usedAnchors & QDeclarativeAnchors::HasBottomAnchor &&
- usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::TopAnchor &&
+ usedAnchors & QDeclarativeAnchors::BottomAnchor &&
+ usedAnchors & QDeclarativeAnchors::VCenterAnchor) {
qmlInfo(item) << QDeclarativeAnchors::tr("Cannot specify top, bottom, and vcenter anchors.");
return false;
- } else if (usedAnchors & QDeclarativeAnchors::HasBaselineAnchor &&
- (usedAnchors & QDeclarativeAnchors::HasTopAnchor ||
- usedAnchors & QDeclarativeAnchors::HasBottomAnchor ||
- usedAnchors & QDeclarativeAnchors::HasVCenterAnchor)) {
+ } else if (usedAnchors & QDeclarativeAnchors::BaselineAnchor &&
+ (usedAnchors & QDeclarativeAnchors::TopAnchor ||
+ usedAnchors & QDeclarativeAnchors::BottomAnchor ||
+ usedAnchors & QDeclarativeAnchors::VCenterAnchor)) {
qmlInfo(item) << QDeclarativeAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.");
return false;
}