From ec4a7acaf4aab00bff801144163ffab6b94fe80c Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Fri, 26 Jul 2024 14:22:59 +0200 Subject: [PATCH] explicit BaseItem in ParameterTreeBuilder --- GUI/Model/Job/ParameterTreeBuilder.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/GUI/Model/Job/ParameterTreeBuilder.cpp b/GUI/Model/Job/ParameterTreeBuilder.cpp index 16323ddc2bd..ead2868b53f 100644 --- a/GUI/Model/Job/ParameterTreeBuilder.cpp +++ b/GUI/Model/Job/ParameterTreeBuilder.cpp @@ -41,28 +41,14 @@ template <typename BaseItem, typename Catalog> ParameterLabelItem* addLabel2(ParameterLabelItem* parent, const QString& category, const BaseItem* p) { - const auto title = category + " (" + Catalog::uiInfo(Catalog::type(p)).menuEntry + ")"; - return new ParameterLabelItem(title, parent); -} - -template <typename Catalog> -ParameterLabelItem* addLabel(ParameterLabelItem* parent, const QString& category, - const typename Catalog::BaseItem* p) -{ - const auto title = category + " (" + Catalog::uiInfo(Catalog::type(p)).menuEntry + ")"; - return new ParameterLabelItem(title, parent); -} - -template <typename Catalog> -ParameterLabelItem* addLabel(ParameterLabelItem* parent, const typename Catalog::BaseItem* p) -{ - const auto title = Catalog::uiInfo(Catalog::type(p)).menuEntry; + const auto title = category == "" + ? Catalog::uiInfo(Catalog::type(p)).menuEntry + : category + " (" + Catalog::uiInfo(Catalog::type(p)).menuEntry + ")"; return new ParameterLabelItem(title, parent); } } // namespace -// ************************************************************************************************ ParameterTreeBuilder::ParameterTreeBuilder(JobItem* jobItem) : m_job_item(jobItem) @@ -261,7 +247,7 @@ ParameterLabelItem* ParameterTreeBuilder::addItemWithParticles(ParameterLabelIte bool enableAbundance, bool enablePosition) { - auto* label = addLabel<ParticleCatalog>(parentLabel, p); + auto* label = addLabel2<ItemWithParticles, ParticleCatalog>(parentLabel, "", p); if (enableAbundance) addParameterItem(label, p->abundance()); -- GitLab