From 08a485349f2bd73682ac806b97d3630c3a7dd3fd Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 7 Mar 2012 22:12:07 +0100 Subject: Allow custom sorting of details-view columns Fix regression that Dolphin 2.0 did not allow to adjust the sorting of the details-view columns. BUG: 164696 FIXED-IN: 4.8.2 --- src/kitemviews/kitemlistheader_p.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/kitemlistheader_p.h') diff --git a/src/kitemviews/kitemlistheader_p.h b/src/kitemviews/kitemlistheader_p.h index 41505585e..56f80c9dd 100644 --- a/src/kitemviews/kitemlistheader_p.h +++ b/src/kitemviews/kitemlistheader_p.h @@ -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 -- cgit v1.3.1