diff --git a/GUI/Models/JobItem.cpp b/GUI/Models/JobItem.cpp index 3e2826a7aa94d346a744e2c15cb65e1580d034fb..ac380a38b4d52192c92dcece77affdc15b09ffdd 100644 --- a/GUI/Models/JobItem.cpp +++ b/GUI/Models/JobItem.cpp @@ -288,6 +288,16 @@ bool JobItem::isCommentsPropertyName(const QString& name) return name == P_COMMENTS; } +const QString JobItem::presentationType() const +{ + return getItemValue(P_PRESENTATION_TYPE).toString(); +} + +void JobItem::setPresentationType(const QString& type) +{ + setItemValue(P_PRESENTATION_TYPE, type); +} + //! Updates the name of file to store intensity data. void JobItem::updateIntensityDataFileName() diff --git a/GUI/Models/JobItem.h b/GUI/Models/JobItem.h index 96c691a47878c1234fa31f08499ce590eef02985..66740d6808bd7d585a4c461f3d62292d14258a2f 100644 --- a/GUI/Models/JobItem.h +++ b/GUI/Models/JobItem.h @@ -43,9 +43,9 @@ private: static const QString P_DURATION; static const QString P_COMMENTS; static const QString P_PROGRESS; + static const QString P_PRESENTATION_TYPE; public: - static const QString P_PRESENTATION_TYPE; static const QString T_SAMPLE; static const QString T_MATERIAL_CONTAINER; static const QString T_INSTRUMENT; @@ -116,6 +116,9 @@ public: static bool isCommentsPropertyName(const QString& name); + const QString presentationType() const; + void setPresentationType(const QString& type); + private: void updateIntensityDataFileName(); const SimulationOptionsItem* simulationOptionsItem() const; diff --git a/GUI/Views/JobWidgets/JobResultsPresenter.cpp b/GUI/Views/JobWidgets/JobResultsPresenter.cpp index 124e4a1feef0a28afe3f3ceaa4a36de8e3926e88..0c2d07434611939a9c448503069e8a6a2d69b14f 100644 --- a/GUI/Views/JobWidgets/JobResultsPresenter.cpp +++ b/GUI/Views/JobWidgets/JobResultsPresenter.cpp @@ -36,8 +36,8 @@ QString JobResultsPresenter::itemPresentation() const if (!currentItem()) return {}; - const auto& value = currentItem()->getItemValue(JobItem::P_PRESENTATION_TYPE); - return value.isValid() ? value.toString() : selectedPresentation(); + const QString value = dynamic_cast<const JobItem*>(currentItem())->presentationType(); + return value.isEmpty() ? selectedPresentation() : value; } void JobResultsPresenter::setPresentation(const QString& presentationType) @@ -46,7 +46,7 @@ void JobResultsPresenter::setPresentation(const QString& presentationType) return; ItemComboWidget::setPresentation(presentationType); - currentItem()->setItemValue(JobItem::P_PRESENTATION_TYPE, presentationType); + dynamic_cast<JobItem*>(currentItem())->setPresentationType(presentationType); } void JobResultsPresenter::setPresentation(JobViewFlags::EActivities activity)