From 632eeef53ff99b117517c2712f158b7ed262ce51 Mon Sep 17 00:00:00 2001 From: garak Date: Sat, 22 Feb 2025 15:52:04 -0500 Subject: [PATCH] fix dropping groups beyond end of group list The issue was that the end-of-list drop zone is quite small and groups were being dropped outside of the bounds of the mapList --- src/ui/maplistmodels.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/maplistmodels.cpp b/src/ui/maplistmodels.cpp index ac07c3a6..8efbc3c0 100644 --- a/src/ui/maplistmodels.cpp +++ b/src/ui/maplistmodels.cpp @@ -277,6 +277,11 @@ bool MapGroupModel::dropMimeData(const QMimeData *data, Qt::DropAction action, i if (parentIndex.row() != -1 || parentIndex.column() != -1) { return false; } + + if (row < 0) { + row = this->rowCount(parentIndex); + } + QByteArray encodedData = data->data("application/porymap.mapgroupmodel.group"); QDataStream stream(&encodedData, QIODevice::ReadOnly); QString groupName; @@ -296,7 +301,6 @@ bool MapGroupModel::dropMimeData(const QMimeData *data, Qt::DropAction action, i } this->insertRow(row, parentIndex); - QModelIndex groupIndex = index(row, 0, parentIndex); QStandardItem *groupItem = this->itemFromIndex(groupIndex); createMapFolderItem(groupName, groupItem);