mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
Fix duplicate Locations appearing in map list
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled
This commit is contained in:
@@ -25,6 +25,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
|
||||
- Fix some menu items under `Tools` not being disabled when their corresponding button is disabled.
|
||||
- Fix the map list search bar stealing keyboard focus whenever a map layout was opened.
|
||||
- Disallow creating prefabs with no metatiles.
|
||||
- Fix new `Location` names created via the `Header` tab temporarily appearing twice after saving.
|
||||
|
||||
## [6.3.1] - 2026-04-12
|
||||
### Added
|
||||
|
||||
@@ -128,16 +128,8 @@ QStandardItem *MapListModel::insertMapItem(const QString &mapName, const QString
|
||||
return nullptr;
|
||||
|
||||
QStandardItem *map = createMapItem(mapName);
|
||||
|
||||
QStandardItem *folder = this->mapFolderItems[folderName];
|
||||
if (!folder) {
|
||||
// Folder doesn't exist yet, add it.
|
||||
folder = insertMapFolderItem(folderName);
|
||||
}
|
||||
// If folder is still nullptr here it's because we failed to create it.
|
||||
if (folder) {
|
||||
folder->appendRow(map);
|
||||
}
|
||||
QStandardItem *folder = insertMapFolderItem(folderName);
|
||||
if (folder) folder->appendRow(map);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -145,6 +137,10 @@ QStandardItem *MapListModel::insertMapFolderItem(const QString &folderName) {
|
||||
if (folderName.isEmpty())
|
||||
return nullptr;
|
||||
|
||||
// If the folder has already been inserted, don't insert it again.
|
||||
auto search = this->mapFolderItems.constFind(folderName);
|
||||
if (search != this->mapFolderItems.constEnd()) return search.value();
|
||||
|
||||
QStandardItem *item = createMapFolderItem(folderName);
|
||||
this->root->appendRow(item);
|
||||
return item;
|
||||
|
||||
Reference in New Issue
Block a user