From 347f53f05532a7e57940e33d558ef31759e1e756 Mon Sep 17 00:00:00 2001 From: Matthias Kuehlewein Date: Fri, 4 Jul 2025 12:49:45 +0200 Subject: [PATCH] TemplateListWidget: Fix cancelling map import The import of a map that was loaded as a template before may invoke a dialog to select scaling options. The Cancel button however did not cancel the import as expected. --- src/gui/widgets/template_list_widget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/template_list_widget.cpp b/src/gui/widgets/template_list_widget.cpp index 5b562c46bd..0bb5d3e882 100644 --- a/src/gui/widgets/template_list_widget.cpp +++ b/src/gui/widgets/template_list_widget.cpp @@ -1,6 +1,6 @@ /* * Copyright 2012, 2013 Thomas Schöps - * Copyright 2012-2020 Kai Pastor + * Copyright 2012-2020, 2025 Kai Pastor * * This file is part of OpenOrienteering. * @@ -860,7 +860,6 @@ void TemplateListWidget::importClicked() prototype->getTransform(transform); Map template_map; - bool ok = true; if (qstrcmp(prototype->getTemplateType(), "OgrTemplate") == 0) { template_map.importMap(*prototype->templateMap(), Map::MinimalObjectImport); @@ -907,12 +906,13 @@ void TemplateListWidget::importClicked() scale_options.append(tr("Scale by current template scaling (%1 %)").arg(locale().toString(current_scale * 100.0, 'f', 1))); if (!scale_options.isEmpty()) { + bool ok; scale_options.prepend(tr("Don't scale")); QString option = QInputDialog::getItem( window(), tr("Template import"), tr("How shall the symbols of the imported template map be scaled?"), scale_options, 0, false, &ok ); - if (option.isEmpty()) + if (!ok || option.isEmpty()) return; else if (option == scale_options[0]) Q_ASSERT(scale == 1.0); @@ -922,7 +922,7 @@ void TemplateListWidget::importClicked() scale = current_scale; } - if (ok && scale != 1.0) + if (scale != 1.0) template_map.scaleAllSymbols(scale); } else