src/declarative/graphicsitems/qdeclarativelistview_p.h
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    48 
    48 
    49 QT_BEGIN_NAMESPACE
    49 QT_BEGIN_NAMESPACE
    50 
    50 
    51 QT_MODULE(Declarative)
    51 QT_MODULE(Declarative)
    52 
    52 
    53 class Q_DECLARATIVE_EXPORT QDeclarativeViewSection : public QObject
    53 class Q_AUTOTEST_EXPORT QDeclarativeViewSection : public QObject
    54 {
    54 {
    55     Q_OBJECT
    55     Q_OBJECT
    56     Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed)
    56     Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed)
    57     Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY changed)
    57     Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY changed)
    58     Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
    58     Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
    84 
    84 
    85 
    85 
    86 class QDeclarativeVisualModel;
    86 class QDeclarativeVisualModel;
    87 class QDeclarativeListViewAttached;
    87 class QDeclarativeListViewAttached;
    88 class QDeclarativeListViewPrivate;
    88 class QDeclarativeListViewPrivate;
    89 class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable
    89 class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable
    90 {
    90 {
    91     Q_OBJECT
    91     Q_OBJECT
    92     Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView)
    92     Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView)
    93 
    93 
    94     Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
    94     Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
   195     QDeclarativeComponent *footer() const;
   195     QDeclarativeComponent *footer() const;
   196     void setFooter(QDeclarativeComponent *);
   196     void setFooter(QDeclarativeComponent *);
   197 
   197 
   198     QDeclarativeComponent *header() const;
   198     QDeclarativeComponent *header() const;
   199     void setHeader(QDeclarativeComponent *);
   199     void setHeader(QDeclarativeComponent *);
       
   200 
       
   201     virtual void setContentX(qreal pos);
       
   202     virtual void setContentY(qreal pos);
   200 
   203 
   201     static QDeclarativeListViewAttached *qmlAttachedProperties(QObject *);
   204     static QDeclarativeListViewAttached *qmlAttachedProperties(QObject *);
   202 
   205 
   203     enum PositionMode { Beginning, Center, End, Visible, Contain };
   206     enum PositionMode { Beginning, Center, End, Visible, Contain };
   204 
   207 
   274             m_isCurrent = c;
   277             m_isCurrent = c;
   275             emit currentItemChanged();
   278             emit currentItemChanged();
   276         }
   279         }
   277     }
   280     }
   278 
   281 
   279     Q_PROPERTY(QString prevSection READ prevSection NOTIFY prevSectionChanged)
   282     Q_PROPERTY(QString previousSection READ prevSection NOTIFY prevSectionChanged)
   280     QString prevSection() const { return m_prevSection; }
   283     QString prevSection() const { return m_prevSection; }
   281     void setPrevSection(const QString &sect) {
   284     void setPrevSection(const QString &sect) {
   282         if (m_prevSection != sect) {
   285         if (m_prevSection != sect) {
   283             m_prevSection = sect;
   286             m_prevSection = sect;
   284             emit prevSectionChanged();
   287             emit prevSectionChanged();
       
   288         }
       
   289     }
       
   290 
       
   291     Q_PROPERTY(QString nextSection READ nextSection NOTIFY nextSectionChanged)
       
   292     QString nextSection() const { return m_nextSection; }
       
   293     void setNextSection(const QString &sect) {
       
   294         if (m_nextSection != sect) {
       
   295             m_nextSection = sect;
       
   296             emit nextSectionChanged();
   285         }
   297         }
   286     }
   298     }
   287 
   299 
   288     Q_PROPERTY(QString section READ section NOTIFY sectionChanged)
   300     Q_PROPERTY(QString section READ section NOTIFY sectionChanged)
   289     QString section() const { return m_section; }
   301     QString section() const { return m_section; }
   308 
   320 
   309 Q_SIGNALS:
   321 Q_SIGNALS:
   310     void currentItemChanged();
   322     void currentItemChanged();
   311     void sectionChanged();
   323     void sectionChanged();
   312     void prevSectionChanged();
   324     void prevSectionChanged();
       
   325     void nextSectionChanged();
   313     void delayRemoveChanged();
   326     void delayRemoveChanged();
   314     void add();
   327     void add();
   315     void remove();
   328     void remove();
   316 
   329 
   317 public:
   330 public:
   318     QDeclarativeListView *m_view;
   331     QDeclarativeListView *m_view;
   319     mutable QString m_section;
   332     mutable QString m_section;
   320     QString m_prevSection;
   333     QString m_prevSection;
       
   334     QString m_nextSection;
   321     bool m_isCurrent : 1;
   335     bool m_isCurrent : 1;
   322     bool m_delayRemove : 1;
   336     bool m_delayRemove : 1;
   323 };
   337 };
   324 
   338 
   325 
   339