diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-07-23 00:16:16 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-07-23 00:16:16 (GMT) |
commit | 8987d9c2946d2cc565cec562393ee3627582699f (patch) | |
tree | 70a5333fefed51724f00918293540ce076c95924 /src | |
parent | dc602e3b9c4d5e4da1d57ed657d82e73401b4531 (diff) | |
parent | 56195216c52b28dc05eb6b2944f0fac01a222fdf (diff) | |
download | Qt-8987d9c2946d2cc565cec562393ee3627582699f.zip Qt-8987d9c2946d2cc565cec562393ee3627582699f.tar.gz Qt-8987d9c2946d2cc565cec562393ee3627582699f.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/extra/qfxflowview.cpp | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxgridview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfximage.h | 1 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 46 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.h | 10 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem_p.h | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxpathview.cpp | 8 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 11 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 3 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 4 |
11 files changed, 29 insertions, 70 deletions
diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp index 0cfb7a9..a0fde47 100644 --- a/src/declarative/extra/qfxflowview.cpp +++ b/src/declarative/extra/qfxflowview.cpp @@ -134,7 +134,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; } } @@ -298,7 +298,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; @@ -318,7 +318,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 4512b46..f3a43e2 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -358,7 +358,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/qfximage.h b/src/declarative/fx/qfximage.h index 9c0dde8..4b6e700 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -43,6 +43,7 @@ #define QFXIMAGE_H #include <QtDeclarative/qfxitem.h> +#include <QtDeclarative/qfxscalegrid.h> #include <QtNetwork/qnetworkreply.h> diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index d229eab..34af32a 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1068,34 +1068,6 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event) */ /*! - \property QFxItem::id - This property holds the identifier for the item. - - The identifier can be used in bindings and other expressions to - refer to the item. For example: - - \qml - Text { id: myText; ... } - Text { text: myText.text } - \endqml - - The identifier is available throughout the \l {components}{component} - where it is declared. The identifier must be unique in thecomponent. -*/ -QString QFxItem::id() const -{ - Q_D(const QFxItem); - return d->_id; -} - -void QFxItem::setId(const QString &id) -{ - Q_D(QFxItem); - setObjectName(id); - d->_id = id; -} - -/*! \internal */ QFxAnchorLine QFxItem::left() const @@ -2017,24 +1989,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..e3f371e 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -48,9 +48,7 @@ #include <QtDeclarative/qfxanchors.h> #include <QtDeclarative/qfxglobal.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qfxscalegrid.h> #include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlstate.h> #include <QtGui/qgraphicsitem.h> #include <QtGui/qfont.h> @@ -100,7 +98,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QFxItem * parent READ itemParent WRITE setItemParent NOTIFY parentChanged DESIGNABLE false FINAL) - Q_PROPERTY(QString id READ id WRITE setId) // ### remove Q_PROPERTY(QmlList<QFxItem *>* children READ children DESIGNABLE false) Q_PROPERTY(QmlList<QObject *>* resources READ resources DESIGNABLE false) Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) @@ -111,7 +108,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) @@ -160,9 +156,6 @@ public: QFxItem *parentItem() const; void setItemParent(QFxItem *parent); // ## setParentItem - QString id() const; // ### remove me - void setId(const QString &); - QmlList<QObject *> *data(); QmlList<QFxItem *> *children(); QmlList<QObject *> *resources(); @@ -208,9 +201,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..029b8b0 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -54,6 +54,7 @@ // #include <QtDeclarative/qfxitem.h> +#include <QtDeclarative/qmlstate.h> #include <private/qmlnullablevalue_p.h> #include <QtDeclarative/qml.h> #include <QtDeclarative/qmlcontext.h> @@ -93,8 +94,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 9c07d6f..54e46cf 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 396aed3..1d4e278 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(); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 916724c..638f20f 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -327,6 +327,10 @@ \value ItemAcceptsInputMethod The item supports input methods typically used for Asian languages. This flag was introduced in Qt 4.6. + + \value ItemNegativeZStacksBehindParent The item automatically stacks + it's parent if it's z-value is negative. + This flag was introduced in Qt 4.6. */ /*! @@ -3726,6 +3730,13 @@ void QGraphicsItem::setZValue(qreal z) itemChange(ItemZValueHasChanged, newZVariant); + if(d_ptr->flags & ItemNegativeZStacksBehindParent) { + if (z < 0) + setFlag(QGraphicsItem::ItemStacksBehindParent, true); + else + setFlag(QGraphicsItem::ItemStacksBehindParent, false); + } + if (d_ptr->isObject) emit static_cast<QGraphicsObject *>(this)->zChanged(); } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 6012053..ba7b5ef 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -100,7 +100,8 @@ public: ItemUsesExtendedStyleOption = 0x200, ItemHasNoContents = 0x400, ItemSendsGeometryChanges = 0x800, - ItemAcceptsInputMethod = 0x1000 + ItemAcceptsInputMethod = 0x1000, + ItemNegativeZStacksBehindParent = 0x2000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 9e30f54..ba24806 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -449,7 +449,7 @@ public: // New 32 bits quint32 fullUpdatePending : 1; - quint32 flags : 13; + quint32 flags : 14; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; @@ -466,7 +466,7 @@ public: quint32 isFocusItemForArea : 1; quint32 hasActiveFocus : 1; quint32 mouseSetsFocus : 1; - quint32 unused : 2; // feel free to use + quint32 unused : 1; // feel free to use // Optional stacking order int globalStackingOrder; |