From 50777b3e3f54fb0894deaa223a0e0a19d5e6b5cc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 2 Aug 2013 13:04:25 +0200 Subject: [PATCH] Fixed issue related to missing legend config Must hide legend config collection. Revisit when a more robust tree building strategy is in place. p4#: 22092 --- ApplicationCode/ProjectDataModel/RimResultSlot.cpp | 9 +++++---- cafUserInterface/cafUiTreeModelPdm.cpp | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimResultSlot.cpp b/ApplicationCode/ProjectDataModel/RimResultSlot.cpp index 6163f5b5e7..90a990291f 100644 --- a/ApplicationCode/ProjectDataModel/RimResultSlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimResultSlot.cpp @@ -66,11 +66,14 @@ RimResultSlot::~RimResultSlot() //-------------------------------------------------------------------------------------------------- void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - if (changedField == &m_resultVariable) + RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue); + + // Update of legend config must happen after RimResultDefinition::fieldChangedByUi(), as this function modifies this->resultVariable() + if (changedField == &m_resultVariableUiField) { if (oldValue != newValue) { - changeLegendConfig(this->resultVariable()); + changeLegendConfig(this->resultVariable()); } if (newValue != RimDefines::undefinedResultName()) @@ -79,8 +82,6 @@ void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, co } } - RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue); - if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw(); } diff --git a/cafUserInterface/cafUiTreeModelPdm.cpp b/cafUserInterface/cafUiTreeModelPdm.cpp index 22d6205be4..8b6b193ed7 100644 --- a/cafUserInterface/cafUiTreeModelPdm.cpp +++ b/cafUserInterface/cafUiTreeModelPdm.cpp @@ -552,6 +552,14 @@ PdmUiTreeItem* UiTreeItemBuilderPdm::buildViewItems(PdmUiTreeItem* parentTreeIte { caf::PdmFieldHandle* field = *it; + // Fix for hidden legend definitions. There is only one visible legend definition, the others reside in a hidden container + // Todo: This is a Hack. Must be rewritten when a more general ui tree building method is in place. + // See comment at top of this method. + if (field->isUiHidden()) + { + continue; + } + std::vector children; field->childObjects(&children); size_t i;