From 6e3476586681e9897570cf2ea1ef5ed7b701bc19 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 27 Dec 2020 17:45:57 +0100 Subject: Allow drop before first separator. --- src/modlistbypriorityproxy.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/modlistbypriorityproxy.cpp') diff --git a/src/modlistbypriorityproxy.cpp b/src/modlistbypriorityproxy.cpp index f07142b4..465c6342 100644 --- a/src/modlistbypriorityproxy.cpp +++ b/src/modlistbypriorityproxy.cpp @@ -160,14 +160,17 @@ bool ModListByPriorityProxy::setData(const QModelIndex& index, const QVariant& v bool ModListByPriorityProxy::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const { - if (!parent.isValid()) { + if (!parent.isValid() && row >= 0) { + // the row may be outside of the children list if we insert at the end if (row >= m_Root.children.size()) { return false; } - if (row >= 0 && (m_Root.children[row]->mod->isSeparator() || m_Root.children[row]->mod->isOverwrite())) { - return false; + if (row > 0 && m_Root.children[row - 1]->mod->isSeparator()) { + if (m_Root.children[row]->mod->isSeparator() || m_Root.children[row]->mod->isOverwrite()) { + return false; + } } } -- cgit v1.3.1