From 332f2a280d3d08434a073b756259a0298a2c1911 Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Wed, 29 Nov 2017 18:47:57 +0100 Subject: [PATCH] Provide implementation for translation of background parameter from GUI to domain (currently still deactivated in translation tests) --- GUI/coregui/Models/InstrumentItem.cpp | 13 +++++++++++++ GUI/coregui/Models/InstrumentItem.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/GUI/coregui/Models/InstrumentItem.cpp b/GUI/coregui/Models/InstrumentItem.cpp index 8e0e87f3b2d..faf933b6e47 100644 --- a/GUI/coregui/Models/InstrumentItem.cpp +++ b/GUI/coregui/Models/InstrumentItem.cpp @@ -17,6 +17,7 @@ #include "InstrumentItem.h" #include "BackgroundItem.h" #include "BeamItem.h" +#include "BornAgainNamespace.h" #include "DetectorItems.h" #include "GUIHelpers.h" #include "SessionModel.h" @@ -78,3 +79,15 @@ void InstrumentItem::importMasks(MaskContainerItem* maskContainer) { detectorItem()->importMasks(maskContainer); } + +QStringList InstrumentItem::translateList(const QStringList& list) const +{ + QStringList result; + // Add CrystalType to path name of basis particle + if (list.back().startsWith(P_BACKGROUND) && list.size()==2) { + result << list[0] << QString::fromStdString(BornAgain::ConstantBackgroundType); + } else { + return SessionItem::translateList(list); + } + return result; +} diff --git a/GUI/coregui/Models/InstrumentItem.h b/GUI/coregui/Models/InstrumentItem.h index 263446f8d09..f38f7eeec26 100644 --- a/GUI/coregui/Models/InstrumentItem.h +++ b/GUI/coregui/Models/InstrumentItem.h @@ -44,6 +44,8 @@ public: void clearMasks(); void importMasks(MaskContainerItem* maskContainer); + + QStringList translateList(const QStringList& list) const override; }; #endif // INSTRUMENTITEM_H -- GitLab