┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index 3d8224adb..a54e06ddc 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -619,6 +619,8 @@ void KItemListView::setHeaderShown(bool show)
connect(m_header, SIGNAL(visibleRoleWidthChanged(QByteArray,qreal,qreal)),
this, SLOT(slotVisibleRoleWidthChanged(QByteArray,qreal,qreal)));
+ connect(m_header, SIGNAL(visibleRoleMoved(QByteArray,int,int)),
+ this, SLOT(slotVisibleRoleMoved(QByteArray,int,int)));
connect(m_header, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
connect(m_header, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
@@ -1237,6 +1239,23 @@ void KItemListView::slotVisibleRoleWidthChanged(const QByteArray& role,
}
}
+void KItemListView::slotVisibleRoleMoved(const QByteArray& role,
+ int currentIndex,
+ int previousIndex)
+{
+ Q_ASSERT(m_visibleRoles[previousIndex] == role);
+
+ const QList<QByteArray> previous = m_visibleRoles;
+
+ QList<QByteArray> current = m_visibleRoles;
+ current.removeAt(previousIndex);
+ current.insert(currentIndex, role);
+
+ setVisibleRoles(current);
+
+ emit visibleRolesChanged(current, previous);
+}
+
void KItemListView::triggerAutoScrolling()
{
if (!m_autoScrollTimer) {