diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-27 17:45:57 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:15 +0100 |
| commit | 6e3476586681e9897570cf2ea1ef5ed7b701bc19 (patch) | |
| tree | f55a9bc427b5287e4efa86f072cf1c766a1c801f /src/modlistbypriorityproxy.cpp | |
| parent | c778f01c895d3c09ceff779dc782fd221186c587 (diff) | |
Allow drop before first separator.
Diffstat (limited to 'src/modlistbypriorityproxy.cpp')
| -rw-r--r-- | src/modlistbypriorityproxy.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
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; + } } } |
