Don't auto-expand Layout folders when searching map list

This commit is contained in:
GriffinR 2025-05-08 19:50:41 -04:00
parent c0fb6022f5
commit 56722f7359
3 changed files with 9 additions and 1 deletions

View File

@ -37,6 +37,9 @@ public:
void setFilterLocked(bool locked) { m_filterLocked = locked; }
bool isFilterLocked() const { return m_filterLocked; }
void setExpandListForSearch(bool expand) { m_expandListForSearch = expand; }
bool getExpandListForSearch() const { return m_expandListForSearch; }
void setSearchFocus();
signals:
@ -51,6 +54,7 @@ private:
bool m_filterLocked = false;
bool m_editsAllowed = false;
bool m_emptyFoldersVisible = true;
bool m_expandListForSearch = true;
};
#endif // MAPLISTTOOLBAR_H

View File

@ -470,6 +470,10 @@ void MainWindow::initMapList() {
ui->mapListToolBar_Locations->setEditsAllowedButtonVisible(false);
ui->mapListToolBar_Layouts->setEditsAllowedButtonVisible(false);
// When searching the Layouts list, don't expand to show all the maps. If the user is searching
// this list then they're probably more interested in the layouts than the maps.
ui->mapListToolBar_Layouts->setExpandListForSearch(false);
// Initialize settings from config
ui->mapListToolBar_Groups->setEditsAllowed(porymapConfig.mapListEditGroupsEnabled);
for (auto i = porymapConfig.mapListHideEmptyEnabled.constBegin(); i != porymapConfig.mapListHideEmptyEnabled.constEnd(); i++) {

View File

@ -138,7 +138,7 @@ void MapListToolBar::applyFilter(const QString &filterText) {
if (filterText.isEmpty()) {
m_list->collapseAll();
emit filterCleared(m_list);
} else {
} else if (m_expandListForSearch) {
m_list->expandToDepth(0);
}
}