summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-07-22 06:56:48 (GMT)
committerLars Knoll <lars.knoll@nokia.com>2009-07-22 06:56:48 (GMT)
commitd5f46ae26ee0cd4a3ccdde526f011b3bdd884abc (patch)
tree2212de57279175c39a1f1648bef57e2531443129 /src/declarative
parent8dc527a3837c937630c8bbbab034b8bc84d496fb (diff)
downloadQt-d5f46ae26ee0cd4a3ccdde526f011b3bdd884abc.zip
Qt-d5f46ae26ee0cd4a3ccdde526f011b3bdd884abc.tar.gz
Qt-d5f46ae26ee0cd4a3ccdde526f011b3bdd884abc.tar.bz2
unify z-value handling in graphics and fx items.
Add a ItemNegativeZStacksBehindParent flag to QGraphicsItem to get the behavior we need in QFxItems. Removed the z property in QFxItems.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/extra/qfxflowview.cpp6
-rw-r--r--src/declarative/fx/qfxgridview.cpp2
-rw-r--r--src/declarative/fx/qfxitem.cpp18
-rw-r--r--src/declarative/fx/qfxitem.h4
-rw-r--r--src/declarative/fx/qfxitem_p.h5
-rw-r--r--src/declarative/fx/qfxlistview.cpp2
-rw-r--r--src/declarative/fx/qfxpathview.cpp8
7 files changed, 12 insertions, 33 deletions
diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp
index 1676512..e1200c7 100644
--- a/src/declarative/extra/qfxflowview.cpp
+++ b/src/declarative/extra/qfxflowview.cpp
@@ -132,7 +132,7 @@ void QFxFlowView::refresh()
for (int ii = 0; ii < m_model->count(); ++ii) {
if (QFxItem *item = m_model->item(ii)) {
item->setParent(this);
- item->setZ(0);
+ item->setZValue(0);
m_items << item;
}
}
@@ -296,7 +296,7 @@ void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (r.contains(event->pos())) {
m_dragItem = item;
- m_dragItem->setZ(1);
+ m_dragItem->setZValue(1);
m_dragOffset = r.topLeft() - event->pos();
event->accept();
return;
@@ -316,7 +316,7 @@ void QFxFlowView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event);
if (m_dragItem) {
- m_dragItem->setZ(0);
+ m_dragItem->setZValue(0);
clearTimeLine();
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index 3c80e98..9528af7 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -356,7 +356,7 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex)
listItem->index = modelIndex;
// complete
model->completeItem();
- listItem->item->setZ(modelIndex + 1);
+ listItem->item->setZValue(modelIndex + 1);
listItem->item->setParent(q->viewport());
}
requestedIndex = 0;
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 354e4cc..42ff436 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -2017,24 +2017,6 @@ QPointF QFxItem::transformOriginPoint() const
return d->transformOrigin();
}
-qreal QFxItem::z() const
-{
- return zValue();
-}
-
-void QFxItem::setZ(qreal z)
-{
- if (z == this->z())
- return;
-
- if (z < 0)
- setFlag(QGraphicsItem::ItemStacksBehindParent, true);
- else
- setFlag(QGraphicsItem::ItemStacksBehindParent, false);
-
- setZValue(z);
-}
-
qreal QFxItem::width() const
{
Q_D(const QFxItem);
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 0dcf852..8e0916e 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -111,7 +111,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) // ### name? Move to own class?
Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) // ### see above
- Q_PROPERTY(qreal z READ z WRITE setZ FINAL) // ### use method in QGO
Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL)
Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged FINAL)
Q_PROPERTY(QFxAnchorLine left READ left CONSTANT FINAL)
@@ -208,9 +207,6 @@ public:
Options options() const;
void setOptions(Options, bool set = true);
- qreal z() const;
- void setZ(qreal);
-
qreal width() const;
void setWidth(qreal);
void setImplicitWidth(qreal);
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index 1615ad8..ec45d6e 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -93,8 +93,9 @@ public:
q->setItemParent(parent);
_baselineOffset.invalidate();
q->setAcceptedMouseButtons(Qt::NoButton);
- q->setFlag(QGraphicsItem::ItemHasNoContents, true);
- q->setFlag(QGraphicsItem::ItemIsFocusable, true);
+ q->setFlags(QGraphicsItem::ItemHasNoContents |
+ QGraphicsItem::ItemIsFocusable |
+ QGraphicsItem::ItemNegativeZStacksBehindParent);
mouseSetsFocus = false;
}
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 50564fb..3515b78 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -423,7 +423,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex)
}
// complete
model->completeItem();
- listItem->item->setZ(modelIndex + 1);
+ listItem->item->setZValue(modelIndex + 1);
listItem->item->setParent(q->viewport());
if (orient == Qt::Vertical)
QObject::connect(listItem->item, SIGNAL(heightChanged()), q, SLOT(itemResized()));
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index 47364d0..4f6fddd 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -581,7 +581,7 @@ void QFxPathViewPrivate::regenerate()
return;
}
items.append(item);
- item->setZ(i);
+ item->setZValue(i);
}
q->refill();
}
@@ -639,7 +639,7 @@ void QFxPathView::refill()
d->firstIndex %= d->model->count();
int index = (d->firstIndex + d->items.count())%d->model->count();
d->items << d->getItem(index);
- d->items.last()->setZ(wrapIndex);
+ d->items.last()->setZValue(wrapIndex);
d->pathOffset++;
d->pathOffset=d->pathOffset % d->items.count();
}
@@ -652,7 +652,7 @@ void QFxPathView::refill()
if (d->firstIndex < 0)
d->firstIndex = d->model->count() - 1;
d->items.prepend(d->getItem(d->firstIndex));
- d->items.first()->setZ(d->firstIndex);
+ d->items.first()->setZValue(d->firstIndex);
d->pathOffset--;
if (d->pathOffset < 0)
d->pathOffset = d->items.count() - 1;
@@ -675,7 +675,7 @@ void QFxPathView::itemsInserted(int modelIndex, int count)
if (d->pathItems == -1) {
for (int i = 0; i < count; ++i) {
QFxItem *item = d->getItem(modelIndex + i);
- item->setZ(modelIndex + i);
+ item->setZValue(modelIndex + i);
d->items.insert(modelIndex + i, item);
}
refill();