keep selected tool when switching tabs

This commit is contained in:
garakmon 2020-04-26 18:55:18 -04:00
parent f57ef7a819
commit 333fe69dd8
3 changed files with 5 additions and 4 deletions

View file

@ -128,7 +128,6 @@ public:
QList<DraggablePixmapItem*> *selected_events = nullptr;
QString map_edit_mode;
QString prev_edit_mode;
int scale_exp = 0;
double scale_base = sqrt(2); // adjust scale factor with this

View file

@ -133,6 +133,8 @@ void Editor::setEditingObjects() {
}
if (map_item) {
map_item->paintingMode = MapPixmapItem::PaintMode::EventObjects;
displayMapConnections();
map_item->draw();
map_item->setVisible(true);
setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked());
}

View file

@ -1216,12 +1216,12 @@ void MainWindow::on_mainTabBar_tabBarClicked(int index)
if (index == 0) {
ui->stackedWidget_MapEvents->setCurrentIndex(0);
on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
clickToolButtonFromEditMode(editor->prev_edit_mode);
} else if (index == 1) {
ui->stackedWidget_MapEvents->setCurrentIndex(1);
editor->prev_edit_mode = editor->map_edit_mode;
editor->setEditingObjects();
clickToolButtonFromEditMode("select");
QStringList validOptions = {"select", "move", "paint", "shift"};
QString newEditMode = validOptions.contains(editor->map_edit_mode) ? editor->map_edit_mode : "select";
clickToolButtonFromEditMode(newEditMode);
} else if (index == 3) {
editor->setEditingConnections();
}