Change filter clearing logic

This commit is contained in:
Diegoisawesome 2018-10-05 11:23:40 -05:00
parent 0e58fed23b
commit 8a7a4c1e8e

View file

@ -263,16 +263,19 @@ void MainWindow::setMap(QString map_name, bool scrollTreeView) {
if (editor->map != nullptr && !editor->map->name.isNull()) {
ui->mapList->setExpanded(mapListProxyModel->mapFromSource(mapListIndexes.value(editor->map->name)), false);
}
ui->mapList->setExpanded(mapListProxyModel->mapFromSource(mapListIndexes.value(map_name)), true);
editor->setMap(map_name);
redrawMapScene();
displayMapProperties();
if (scrollTreeView) {
// Make sure we clear the filter first so we actually have a scroll target
mapListProxyModel->setFilterRegExp(QString::null);
ui->mapList->setCurrentIndex(mapListProxyModel->mapFromSource(mapListIndexes.value(map_name)));
ui->mapList->scrollTo(ui->mapList->currentIndex(), QAbstractItemView::PositionAtCenter);
}
ui->mapList->setExpanded(mapListProxyModel->mapFromSource(mapListIndexes.value(map_name)), true);
setWindowTitle(map_name + " - " + editor->project->getProjectTitle());
connect(editor->map, SIGNAL(mapChanged(Map*)), this, SLOT(onMapChanged(Map *)));
@ -338,7 +341,6 @@ void MainWindow::openWarpMap(QString map_name, QString warp_num) {
}
// Open the destination map, and select the target warp event.
mapListProxyModel->setFilterRegExp(QString::null);
setMap(map_name, true);
QList<Event*> warp_events = editor->map->events["warp_event_group"];
if (warp_events.length() > warpNum) {