]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontainer.h
Improve drawing selected items in Compact/Details View and Places Panel
[dolphin.git] / src / kitemviews / kitemlistcontainer.h
index 5f846a9bfa5230e98e3b25fe332a7099b9fc8102..474a9ecc03d3528c4208ff73bf2eff564970e3c7 100644 (file)
@@ -29,6 +29,7 @@
 #include <QAbstractScrollArea>
 
 class KItemListController;
+class KItemListSmoothScroller;
 class KItemListView;
 class KItemModelBase;
 class QPropertyAnimation;
@@ -36,6 +37,8 @@ class QPropertyAnimation;
 /**
  * @brief Provides a QWidget based scrolling view for a KItemListController.
  *
+ * The model and view are maintained by the KItemListController.
+ *
  * @see KItemListController
  */
 class LIBDOLPHINPRIVATE_EXPORT KItemListContainer : public QAbstractScrollArea
@@ -43,36 +46,50 @@ class LIBDOLPHINPRIVATE_EXPORT KItemListContainer : public QAbstractScrollArea
     Q_OBJECT
 
 public:
+    /**
+     * @param controller Controller that maintains the model and the view.
+     *                   The KItemListContainer takes ownership of the controller
+     *                   (the parent will be set to the KItemListContainer).
+     * @param parent     Optional parent widget.
+     */
     explicit KItemListContainer(KItemListController* controller, QWidget* parent = 0);
-    KItemListContainer(QWidget* parent = 0);
     virtual ~KItemListContainer();
-
     KItemListController* controller() const;
 
+    void setEnabledFrame(bool enable);
+    bool enabledFrame() const;
+
 protected:
     virtual void keyPressEvent(QKeyEvent* event);
     virtual void showEvent(QShowEvent* event);
     virtual void resizeEvent(QResizeEvent* event);
     virtual void scrollContentsBy(int dx, int dy);
-    virtual bool eventFilter(QObject* obj, QEvent* event);
     virtual void wheelEvent(QWheelEvent* event);
 
 private slots:
+    void slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
     void slotModelChanged(KItemModelBase* current, KItemModelBase* previous);
     void slotViewChanged(KItemListView* current, KItemListView* previous);
-    void slotAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
     void scrollTo(qreal offset);
-    void updateScrollBars();
+    void updateScrollOffsetScrollBar();
+    void updateItemOffsetScrollBar();
 
 private:
-    void initialize();
     void updateGeometries();
+    void updateSmoothScrollers(Qt::Orientation orientation);
+
+    /**
+     * Helper method for updateScrollOffsetScrollBar(). Updates the scrollbar-policy
+     * to Qt::ScrollBarAlwaysOn for cases where turning off the scrollbar might lead
+     * to an endless layout loop (see bug #293318).
+     */
+    void updateScrollOffsetScrollBarPolicy();
 
 private:
     KItemListController* m_controller;
 
-    bool m_smoothScrolling;
-    QPropertyAnimation* m_smoothScrollingAnimation;
+    KItemListSmoothScroller* m_horizontalSmoothScroller;
+    KItemListSmoothScroller* m_verticalSmoothScroller;
 };
 
 #endif