From 16b825bc5d9a03a3d0ef6453e07cf298e23965a2 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Mon, 11 Jan 2021 20:57:32 +0100 Subject: Fix drop in first item of separators. --- src/modlistsortproxy.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index bc28490f..1077a833 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -18,6 +18,7 @@ along with Mod Organizer. If not, see . */ #include "modlistsortproxy.h" +#include "modlistbypriorityproxy.h" #include "modlistdropinfo.h" #include "modinfo.h" #include "profile.h" @@ -279,7 +280,6 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const bool ModListSortProxy::optionsMatchMod(ModInfo::Ptr info, bool) const { - return true; } @@ -598,6 +598,11 @@ bool ModListSortProxy::filterAcceptsRow(int source_row, const QModelIndex &paren } } +bool ModListSortProxy::sourceIsByPriorityProxy() const +{ + return dynamic_cast(sourceModel()) != nullptr; +} + bool ModListSortProxy::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const { ModListDropInfo dropInfo(data, *m_Organizer); @@ -620,7 +625,7 @@ bool ModListSortProxy::canDropMimeData(const QMimeData* data, Qt::DropAction act // in the regular model, when dropping between rows, the row-value passed to // the sourceModel is inconsistent between ascending and descending ordering. // This should fix that - if (sortOrder() == Qt::DescendingOrder && row != -1) { + if (sortOrder() == Qt::DescendingOrder && row != -1 && !sourceIsByPriorityProxy()) { --row; } @@ -645,7 +650,7 @@ bool ModListSortProxy::dropMimeData(const QMimeData *data, Qt::DropAction action // in the regular model, when dropping between rows, the row-value passed to // the sourceModel is inconsistent between ascending and descending ordering. // This should fix that - if (sortOrder() == Qt::DescendingOrder && row != -1) { + if (sortOrder() == Qt::DescendingOrder && row != -1 && !sourceIsByPriorityProxy()) { --row; } -- cgit v1.3.1