equal
deleted
inserted
replaced
41 |
41 |
42 #ifndef QDECLARATIVELISTVIEW_H |
42 #ifndef QDECLARATIVELISTVIEW_H |
43 #define QDECLARATIVELISTVIEW_H |
43 #define QDECLARATIVELISTVIEW_H |
44 |
44 |
45 #include "private/qdeclarativeflickable_p.h" |
45 #include "private/qdeclarativeflickable_p.h" |
|
46 #include "private/qdeclarativeguard_p.h" |
46 |
47 |
47 QT_BEGIN_HEADER |
48 QT_BEGIN_HEADER |
48 |
49 |
49 QT_BEGIN_NAMESPACE |
50 QT_BEGIN_NAMESPACE |
50 |
51 |
51 QT_MODULE(Declarative) |
52 QT_MODULE(Declarative) |
52 |
53 |
53 class Q_AUTOTEST_EXPORT QDeclarativeViewSection : public QObject |
54 class Q_AUTOTEST_EXPORT QDeclarativeViewSection : public QObject |
54 { |
55 { |
55 Q_OBJECT |
56 Q_OBJECT |
56 Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed) |
57 Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged) |
57 Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY changed) |
58 Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY criteriaChanged) |
58 Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) |
59 Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) |
59 Q_ENUMS(SectionCriteria) |
60 Q_ENUMS(SectionCriteria) |
60 public: |
61 public: |
61 QDeclarativeViewSection(QObject *parent=0) : QObject(parent), m_criteria(FullString), m_delegate(0) {} |
62 QDeclarativeViewSection(QObject *parent=0) : QObject(parent), m_criteria(FullString), m_delegate(0) {} |
62 |
63 |
71 void setDelegate(QDeclarativeComponent *delegate); |
72 void setDelegate(QDeclarativeComponent *delegate); |
72 |
73 |
73 QString sectionString(const QString &value); |
74 QString sectionString(const QString &value); |
74 |
75 |
75 Q_SIGNALS: |
76 Q_SIGNALS: |
76 void changed(); |
77 void propertyChanged(); |
|
78 void criteriaChanged(); |
77 void delegateChanged(); |
79 void delegateChanged(); |
78 |
80 |
79 private: |
81 private: |
80 QString m_property; |
82 QString m_property; |
81 SectionCriteria m_criteria; |
83 SectionCriteria m_criteria; |
242 virtual qreal minYExtent() const; |
244 virtual qreal minYExtent() const; |
243 virtual qreal maxYExtent() const; |
245 virtual qreal maxYExtent() const; |
244 virtual qreal minXExtent() const; |
246 virtual qreal minXExtent() const; |
245 virtual qreal maxXExtent() const; |
247 virtual qreal maxXExtent() const; |
246 virtual void keyPressEvent(QKeyEvent *); |
248 virtual void keyPressEvent(QKeyEvent *); |
|
249 virtual void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry); |
247 virtual void componentComplete(); |
250 virtual void componentComplete(); |
248 |
251 |
249 private Q_SLOTS: |
252 private Q_SLOTS: |
250 void refill(); |
253 void refill(); |
251 void trackedPositionChanged(); |
254 void trackedPositionChanged(); |
265 public: |
268 public: |
266 QDeclarativeListViewAttached(QObject *parent) |
269 QDeclarativeListViewAttached(QObject *parent) |
267 : QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {} |
270 : QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {} |
268 ~QDeclarativeListViewAttached() {} |
271 ~QDeclarativeListViewAttached() {} |
269 |
272 |
270 Q_PROPERTY(QDeclarativeListView *view READ view CONSTANT) |
273 Q_PROPERTY(QDeclarativeListView *view READ view NOTIFY viewChanged) |
271 QDeclarativeListView *view() { return m_view; } |
274 QDeclarativeListView *view() { return m_view; } |
|
275 void setView(QDeclarativeListView *view) { |
|
276 if (view != m_view) { |
|
277 m_view = view; |
|
278 emit viewChanged(); |
|
279 } |
|
280 } |
272 |
281 |
273 Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) |
282 Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) |
274 bool isCurrentItem() const { return m_isCurrent; } |
283 bool isCurrentItem() const { return m_isCurrent; } |
275 void setIsCurrentItem(bool c) { |
284 void setIsCurrentItem(bool c) { |
276 if (m_isCurrent != c) { |
285 if (m_isCurrent != c) { |
324 void prevSectionChanged(); |
333 void prevSectionChanged(); |
325 void nextSectionChanged(); |
334 void nextSectionChanged(); |
326 void delayRemoveChanged(); |
335 void delayRemoveChanged(); |
327 void add(); |
336 void add(); |
328 void remove(); |
337 void remove(); |
|
338 void viewChanged(); |
329 |
339 |
330 public: |
340 public: |
331 QDeclarativeListView *m_view; |
341 QDeclarativeGuard<QDeclarativeListView> m_view; |
332 mutable QString m_section; |
342 mutable QString m_section; |
333 QString m_prevSection; |
343 QString m_prevSection; |
334 QString m_nextSection; |
344 QString m_nextSection; |
335 bool m_isCurrent : 1; |
345 bool m_isCurrent : 1; |
336 bool m_delayRemove : 1; |
346 bool m_delayRemove : 1; |