summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativelistview_p.h
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-26 01:44:03 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-08-26 01:44:03 (GMT)
commit8bedba8ecb9cde3de68defea3e2b062504224aa6 (patch)
tree1cf7327df58f27869efae499f5a92a2786fa876d /src/declarative/graphicsitems/qdeclarativelistview_p.h
parent407e131dfc2f85518e42be6ca7a2b43946d0413c (diff)
downloadQt-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/qdeclarativelistview_p.h')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index b264861..14925d7 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -43,6 +43,7 @@
#define QDECLARATIVELISTVIEW_H
#include "private/qdeclarativeflickable_p.h"
+#include "private/qdeclarativeguard_p.h"
QT_BEGIN_HEADER
@@ -268,8 +269,14 @@ public:
: QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {}
~QDeclarativeListViewAttached() {}
- Q_PROPERTY(QDeclarativeListView *view READ view CONSTANT)
+ Q_PROPERTY(QDeclarativeListView *view READ view WRITE setView NOTIFY viewChanged)
QDeclarativeListView *view() { return m_view; }
+ void setView(QDeclarativeListView *view) {
+ if (view != m_view) {
+ m_view = view;
+ emit viewChanged();
+ }
+ }
Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged)
bool isCurrentItem() const { return m_isCurrent; }
@@ -327,9 +334,10 @@ Q_SIGNALS:
void delayRemoveChanged();
void add();
void remove();
+ void viewChanged();
public:
- QDeclarativeListView *m_view;
+ QDeclarativeGuard<QDeclarativeListView> m_view;
mutable QString m_section;
QString m_prevSection;
QString m_nextSection;