Section headers ignore list delegate size changes when "colliding"
[profile/ivi/qtdeclarative.git] / src / quick / items / qquicklistview_p.h
index bffd935..827dac0 100644 (file)
@@ -3,7 +3,7 @@
 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/
 **
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** GNU Lesser General Public License Usage
@@ -44,7 +44,7 @@
 
 #include "qquickitemview_p.h"
 
-#include <private/qdeclarativeguard_p.h>
+#include <private/qqmlguard_p.h>
 
 QT_BEGIN_HEADER
 
@@ -57,7 +57,7 @@ class Q_AUTOTEST_EXPORT QQuickViewSection : public QObject
     Q_OBJECT
     Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
     Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY criteriaChanged)
-    Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
+    Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
     Q_PROPERTY(int labelPositioning READ labelPositioning WRITE setLabelPositioning NOTIFY labelPositioningChanged)
     Q_ENUMS(SectionCriteria)
     Q_ENUMS(LabelPositioning)
@@ -71,8 +71,8 @@ public:
     SectionCriteria criteria() const { return m_criteria; }
     void setCriteria(SectionCriteria);
 
-    QDeclarativeComponent *delegate() const { return m_delegate; }
-    void setDelegate(QDeclarativeComponent *delegate);
+    QQmlComponent *delegate() const { return m_delegate; }
+    void setDelegate(QQmlComponent *delegate);
 
     QString sectionString(const QString &value);
 
@@ -81,6 +81,7 @@ public:
     void setLabelPositioning(int pos);
 
 Q_SIGNALS:
+    void sectionsChanged();
     void propertyChanged();
     void criteriaChanged();
     void delegateChanged();
@@ -89,7 +90,7 @@ Q_SIGNALS:
 private:
     QString m_property;
     SectionCriteria m_criteria;
-    QDeclarativeComponent *m_delegate;
+    QQmlComponent *m_delegate;
     int m_labelPositioning;
     QQuickListViewPrivate *m_view;
 };
@@ -102,10 +103,8 @@ class Q_AUTOTEST_EXPORT QQuickListView : public QQuickItemView
     Q_OBJECT
     Q_DECLARE_PRIVATE(QQuickListView)
 
-    // XXX deprecate these two properties (only duration should be necessary)
-    Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
-    Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
-
+    Q_PROPERTY(qreal highlightMoveVelocity READ highlightMoveVelocity WRITE setHighlightMoveVelocity NOTIFY highlightMoveVelocityChanged)
+    Q_PROPERTY(qreal highlightResizeVelocity READ highlightResizeVelocity WRITE setHighlightResizeVelocity NOTIFY highlightResizeVelocityChanged)
     Q_PROPERTY(int highlightResizeDuration READ highlightResizeDuration WRITE setHighlightResizeDuration NOTIFY highlightResizeDurationChanged)
 
     Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
@@ -136,11 +135,11 @@ public:
 
     virtual void setHighlightFollowsCurrentItem(bool);
 
-    qreal highlightMoveSpeed() const;
-    void setHighlightMoveSpeed(qreal);
+    qreal highlightMoveVelocity() const;
+    void setHighlightMoveVelocity(qreal);
 
-    qreal highlightResizeSpeed() const;
-    void setHighlightResizeSpeed(qreal);
+    qreal highlightResizeVelocity() const;
+    void setHighlightResizeVelocity(qreal);
 
     int highlightResizeDuration() const;
     void setHighlightResizeDuration(int);
@@ -161,18 +160,16 @@ Q_SIGNALS:
     void spacingChanged();
     void orientationChanged();
     void currentSectionChanged();
-    void highlightMoveSpeedChanged();
-    void highlightResizeSpeedChanged();
+    void highlightMoveVelocityChanged();
+    void highlightResizeVelocityChanged();
     void highlightResizeDurationChanged();
     void snapModeChanged();
 
 protected:
-    virtual void viewportMoved();
+    virtual void viewportMoved(Qt::Orientations orient);
     virtual void keyPressEvent(QKeyEvent *);
     virtual void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry);
-
-protected Q_SLOTS:
-    void updateSections();
+    virtual void initItem(int index, QQuickItem *item);
 };
 
 class QQuickListViewAttached : public QQuickItemViewAttached
@@ -181,7 +178,7 @@ class QQuickListViewAttached : public QQuickItemViewAttached
 
 public:
     QQuickListViewAttached(QObject *parent)
-        : QQuickItemViewAttached(parent), m_view(0) {}
+        : QQuickItemViewAttached(parent), m_view(0), m_sectionItem(0) {}
     ~QQuickListViewAttached() {}
 
     Q_PROPERTY(QQuickListView *view READ view NOTIFY viewChanged)
@@ -197,7 +194,8 @@ Q_SIGNALS:
     void viewChanged();
 
 public:
-    QDeclarativeGuard<QQuickListView> m_view;
+    QQmlGuard<QQuickListView> m_view;
+    QQuickItem *m_sectionItem;
 };