Skip to content

Commit

Permalink
use full path comparison for drag and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton committed Jul 31, 2020
1 parent 09390e1 commit 3b574d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Models/TreeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ QMimeData *TreeModel::mimeData(const QModelIndexList &indexes) const {

// rows are moved starting with the lowest so we can create
// unique names in the order of insertion
std::sort(nodes.begin(), nodes.end(), std::less<QModelIndex>());
using pathComparator = std::function<bool(const QModelIndex & a, const QModelIndex & b)>;
pathComparator compareIndexes =
[&compareIndexes](const QModelIndex & a, const QModelIndex & b) -> bool {
if (a.parent() == b.parent())
return a < b;
return compareIndexes(a.parent(),b.parent());
};
std::sort(nodes.begin(), nodes.end(), compareIndexes);

stream << QCoreApplication::applicationPid();
stream << nodes.count();
Expand Down

0 comments on commit 3b574d7

Please sign in to comment.