From 29f88e6b76c6c41bc9f88c9e61120b3e6077b7b5 Mon Sep 17 00:00:00 2001 From: garak Date: Sat, 22 Feb 2025 15:32:14 -0500 Subject: [PATCH] fix drag+drop on groups moved upward in list --- src/ui/maplistmodels.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/maplistmodels.cpp b/src/ui/maplistmodels.cpp index 0d42b896..ac07c3a6 100644 --- a/src/ui/maplistmodels.cpp +++ b/src/ui/maplistmodels.cpp @@ -285,18 +285,18 @@ bool MapGroupModel::dropMimeData(const QMimeData *data, Qt::DropAction action, i stream >> groupName; } - this->insertRow(row, parentIndex); - // copy children to new node int sourceRow = data->data("application/porymap.mapgroupmodel.source.row").toInt(); QModelIndex originIndex = this->index(sourceRow, 0); QModelIndexList children; QStringList mapsToMove; for (int i = 0; i < this->rowCount(originIndex); ++i ) { - children << this->index( i, 0, originIndex); - mapsToMove << this->index( i, 0 , originIndex).data(MapListUserRoles::NameRole).toString(); + children << this->index(i, 0, originIndex); + mapsToMove << this->index(i, 0 , originIndex).data(MapListUserRoles::NameRole).toString(); } + this->insertRow(row, parentIndex); + QModelIndex groupIndex = index(row, 0, parentIndex); QStandardItem *groupItem = this->itemFromIndex(groupIndex); createMapFolderItem(groupName, groupItem);