]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistheader_p.h
Allow custom sorting of details-view columns
[dolphin.git] / src / kitemviews / kitemlistheader_p.h
index 41505585ee2b4c9003d03aa4c42938820013e748..56f80c9dd698ded14d262c3772dc76756d0bacef 100644 (file)
@@ -60,6 +60,11 @@ signals:
                                  qreal currentWidth,
                                  qreal previousWidth);
 
+    /**
+     * Is emitted if the position of the visible role has been changed.
+     */
+    void visibleRoleMoved(const QByteArray& role, int currentIndex, int previousIndex);
+
     /**
      * Is emitted if the user has changed the sort order by clicking on a
      * header item. The sort order of the model has already been adjusted to
@@ -89,13 +94,30 @@ private slots:
     void slotSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous);
 
 private:
-    void paintRole(QPainter* painter, const QByteArray& role, const QRectF& rect, int orderIndex);
+    void paintRole(QPainter* painter, const QByteArray& role, const QRectF& rect, int orderIndex) const;
 
     void updatePressedRoleIndex(const QPointF& pos);
     void updateHoveredRoleIndex(const QPointF& pos);
     int roleIndexAt(const QPointF& pos) const;
     bool isAboveRoleGrip(const QPointF& pos, int roleIndex) const;
 
+    /**
+     * Creates a pixmap of the role with the index \a roleIndex that is shown
+     * during moving a role.
+     */
+    QPixmap createRolePixmap(int roleIndex) const;
+
+    /**
+     * @return Target index of the currently moving visible role based on the current
+     *         state of m_movingRole.
+     */
+    int targetOfMovingRole() const;
+
+    /**
+     * @return x-position of the left border of the role \a role.
+     */
+    qreal roleXPosition(const QByteArray& role) const;
+
 private:
     enum RoleOperation
     {
@@ -112,6 +134,14 @@ private:
     int m_pressedRoleIndex;
     RoleOperation m_roleOperation;
     QPointF m_pressedMousePos;
+
+    struct MovingRole
+    {
+        QPixmap pixmap;
+        int x;
+        int xDec;
+        int index;
+    } m_movingRole;
 };
 
 #endif