┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistheader_p.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-03-07 22:12:07 +0100
committerPeter Penz <[email protected]>2012-03-07 22:18:59 +0100
commit08a485349f2bd73682ac806b97d3630c3a7dd3fd (patch)
tree196869487673eeca1f4d2a3b208efb0f329951d7 /src/kitemviews/kitemlistheader_p.h
parent90e6190f13caa50773c5d84550a7b42a18adce13 (diff)
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
Diffstat (limited to 'src/kitemviews/kitemlistheader_p.h')
-rw-r--r--src/kitemviews/kitemlistheader_p.h32
1 files changed, 31 insertions, 1 deletions
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
@@ -61,6 +61,11 @@ signals:
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
* the current sort order. Note that no signal will be emitted if the
@@ -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