From f6c86e0eedad23719fd05474e9ba8392853554c2 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Wed, 20 May 2020 18:30:17 -0500 Subject: [PATCH] Eliminate unnecessary expensive map redraw when opening a map --- include/mainwindow.h | 1 + src/mainwindow.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/mainwindow.h b/include/mainwindow.h index c575a6ec..1711645e 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -268,6 +268,7 @@ private: bool setMap(QString, bool scrollTreeView = false); void redrawMapScene(); + void refreshMapScene(); bool loadDataStructures(); bool loadProjectCombos(); bool populateMapList(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 94d3218b..6a306892 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -439,7 +439,7 @@ bool MainWindow::setMap(QString map_name, bool scrollTreeView) { ui->mapList->setExpanded(mapListProxyModel->mapFromSource(mapListIndexes.value(editor->map->name)), false); } - redrawMapScene(); + refreshMapScene(); displayMapProperties(); if (scrollTreeView) { @@ -469,6 +469,11 @@ void MainWindow::redrawMapScene() if (!editor->displayMap()) return; + this->refreshMapScene(); +} + +void MainWindow::refreshMapScene() +{ on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex()); double base = editor->scale_base;