From ebfeb2fbf95df4a2246ff2ef1cd6b48f373b70f3 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 14 Dec 2014 18:25:26 +0100 Subject: - mod-list can now be re-ordered with drag&drop while grouping is active - drag&drop is not disabled when ordering by other columns than priority. MO will notify using messagedialog that it's impossible instead. --- src/qtgroupingproxy.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/qtgroupingproxy.cpp') diff --git a/src/qtgroupingproxy.cpp b/src/qtgroupingproxy.cpp index 45ff192b..64ca5241 100644 --- a/src/qtgroupingproxy.cpp +++ b/src/qtgroupingproxy.cpp @@ -866,6 +866,23 @@ QtGroupingProxy::hasChildren( const QModelIndex &parent ) const return sourceModel()->hasChildren( mapToSource( parent ) ); } +bool +QtGroupingProxy::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) +{ + QModelIndex idx = index(row, column, parent); + if (isGroup(idx)) { + QList childRows = m_groupHash.value(idx.row()); + int max = *std::max_element(childRows.begin(), childRows.end()); + + QModelIndex newIdx = mapToSource(index(max, column, idx)); + return sourceModel()->dropMimeData(data, action, max, column, newIdx); + } else { + QModelIndex idx = mapToSource(index(row, column, parent)); + + return sourceModel()->dropMimeData(data, action, idx.row(), idx.column(), idx.parent()); + } +} + void QtGroupingProxy::modelRowsAboutToBeInserted( const QModelIndex &parent, int start, int end ) { -- cgit v1.3.1