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);