Upgrade old element type names in saved query presets too

A query saved to nomenclature.json (Load/Save in the query editor, since
2020) before June 2022 still says element_type = 'Simple'. Loading it
ticked none of the type boxes and kept the old query, so the new table
came out empty. Pass it through LegacyElementTypes::upgradeQuery() as
ProjectDBModel::fromXml() now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-28 05:55:20 +13:00
parent 539708da3c
commit adcf11270c
+4 -1
View File
@@ -20,6 +20,7 @@
#include "../../properties/elementdata.h"
#include "../../qetapp.h"
#include "../../qetinformation.h"
#include "../legacyelementtypes.h"
#include "../projectdatabase.h"
#include "ui_elementquerywidget.h"
@@ -674,7 +675,9 @@ void ElementQueryWidget::on_m_load_pb_clicked()
auto value_object = value.toObject();
if (value_object.value("query").isString()) {
setQuery(value_object.value("query").toString());
//A query saved before June 2022 names element types the old way
setQuery(LegacyElementTypes::upgradeQuery(
value_object.value("query").toString()));
}
}