diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-08 02:38:17 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-08 02:38:17 (GMT) |
commit | 2d3323d239c9d20c98e09c9398931e60bb799cca (patch) | |
tree | b5484d2eb06cfc60759e45f7b8fc82176ab09b07 /src/declarative/graphicsitems/qdeclarativepathview_p.h | |
parent | 9bc81769eb6ebc9bd62fe3c1d86e67ddccbed8b6 (diff) | |
download | Qt-2d3323d239c9d20c98e09c9398931e60bb799cca.zip Qt-2d3323d239c9d20c98e09c9398931e60bb799cca.tar.gz Qt-2d3323d239c9d20c98e09c9398931e60bb799cca.tar.bz2 |
Add PathView.isCurrentIndex and PathView.view attached properties
Adding PathView attached properties to be in line with other views.
Task-number: QT-319
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepathview_p.h')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepathview_p.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index df9c6ae..6dbd044 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativePathViewPrivate; +class QDeclarativePathViewAttached; class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem { Q_OBJECT @@ -96,7 +97,7 @@ public: int pathItemCount() const; void setPathItemCount(int); - static QObject *qmlAttachedProperties(QObject *); + static QDeclarativePathViewAttached *qmlAttachedProperties(QObject *); Q_SIGNALS: void currentIndexChanged(); @@ -127,11 +128,57 @@ private Q_SLOTS: private: friend class QDeclarativePathViewAttached; - static QHash<QObject*, QObject*> attachedProperties; Q_DISABLE_COPY(QDeclarativePathView) Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativePathView) }; +class QDeclarativeOpenMetaObject; +class QDeclarativePathViewAttached : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativePathView *view READ view CONSTANT) + Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) + Q_PROPERTY(bool onPath READ isOnPath NOTIFY pathChanged) + +public: + QDeclarativePathViewAttached(QObject *parent); + ~QDeclarativePathViewAttached(); + + QDeclarativePathView *view() { return m_view; } + + bool isCurrentItem() const { return m_isCurrent; } + void setIsCurrentItem(bool c) { + if (m_isCurrent != c) { + m_isCurrent = c; + emit currentItemChanged(); + } + } + + QVariant value(const QByteArray &name) const; + void setValue(const QByteArray &name, const QVariant &val); + + bool isOnPath() const { return m_onPath; } + void setOnPath(bool on) { + if (on != m_onPath) { + m_onPath = on; + emit pathChanged(); + } + } + +Q_SIGNALS: + void currentItemChanged(); + void pathChanged(); + +private: + friend class QDeclarativePathViewPrivate; + QDeclarativePathView *m_view; + QDeclarativeOpenMetaObject *m_metaobject; + bool m_onPath : 1; + bool m_isCurrent : 1; +}; + + QT_END_NAMESPACE QML_DECLARE_TYPE(QDeclarativePathView) |