diff options
| author | Tannin <devnull@localhost> | 2014-12-14 18:25:26 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-12-14 18:25:26 +0100 |
| commit | ebfeb2fbf95df4a2246ff2ef1cd6b48f373b70f3 (patch) | |
| tree | c0aae4337a991993c802ad5feff71a5b099b013a /src/qtgroupingproxy.cpp | |
| parent | f666e3d835147de3f044431474f92ec84fd8b801 (diff) | |
- 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.
Diffstat (limited to 'src/qtgroupingproxy.cpp')
| -rw-r--r-- | src/qtgroupingproxy.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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<int> 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 )
{
|
