diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-26 01:44:03 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-26 01:44:03 (GMT) |
commit | 8bedba8ecb9cde3de68defea3e2b062504224aa6 (patch) | |
tree | 1cf7327df58f27869efae499f5a92a2786fa876d /src/declarative/graphicsitems/qdeclarativegridview_p.h | |
parent | 407e131dfc2f85518e42be6ca7a2b43946d0413c (diff) | |
download | Qt-8bedba8ecb9cde3de68defea3e2b062504224aa6.zip Qt-8bedba8ecb9cde3de68defea3e2b062504224aa6.tar.gz Qt-8bedba8ecb9cde3de68defea3e2b062504224aa6.tar.bz2 |
Fix ListView.view attached property with VisualItemModel
We assumed that the attached object was created at the same time as
the item.
Task-number: QTBUG-13166
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativegridview_p.h')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview_p.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index d6bbaf3..fdb6f94 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -43,6 +43,7 @@ #define QDECLARATIVEGRIDVIEW_H #include "private/qdeclarativeflickable_p.h" +#include "private/qdeclarativeguard_p.h" QT_BEGIN_HEADER @@ -220,8 +221,14 @@ public: : QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {} ~QDeclarativeGridViewAttached() {} - Q_PROPERTY(QDeclarativeGridView *view READ view CONSTANT) + Q_PROPERTY(QDeclarativeGridView *view READ view WRITE setView NOTIFY viewChanged) QDeclarativeGridView *view() { return m_view; } + void setView(QDeclarativeGridView *view) { + if (view != m_view) { + m_view = view; + emit viewChanged(); + } + } Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) bool isCurrentItem() const { return m_isCurrent; } @@ -249,9 +256,10 @@ Q_SIGNALS: void delayRemoveChanged(); void add(); void remove(); + void viewChanged(); public: - QDeclarativeGridView *m_view; + QDeclarativeGuard<QDeclarativeGridView> m_view; bool m_isCurrent : 1; bool m_delayRemove : 1; }; |