From 2ae87738fd0514640930a5cd786bf8a614ff564f Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 28 Sep 2023 13:29:06 -0400 Subject: [PATCH] Handle discontinous mapsec values in map list --- src/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 92fbe5b5..49c04394 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1156,18 +1156,18 @@ void MainWindow::sortMapList() { case MapSortOrder::Area: { QMap mapsecToGroupNum; - for (int i = 0; i < project->mapSectionNameToValue.size(); i++) { - QString mapsec_name = project->mapSectionValueToName.value(i); + int row = 0; + for (auto mapsec_value : project->mapSectionValueToName.keys()) { + QString mapsec_name = project->mapSectionValueToName.value(mapsec_value); QStandardItem *mapsec = new QStandardItem; mapsec->setText(mapsec_name); mapsec->setIcon(folderIcon); mapsec->setEditable(false); mapsec->setData(mapsec_name, Qt::UserRole); mapsec->setData("map_sec", MapListUserRoles::TypeRole); - mapsec->setData(i, MapListUserRoles::GroupRole); root->appendRow(mapsec); mapGroupItemsList->append(mapsec); - mapsecToGroupNum.insert(mapsec_name, i); + mapsecToGroupNum.insert(mapsec_name, row++); } for (int i = 0; i < project->groupNames.length(); i++) { QStringList names = project->groupedMapNames.value(i);