From c555f77a71397e40d82dd41955dc95e987b81f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 14 Dec 2016 09:12:27 +0100 Subject: [PATCH] AppFwk: Added a convenince constructor to PdmOptionItemInfo to make it easier to use PdmPtrField --- .../cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp | 11 +++++++++++ .../cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp index 55d76423a9..d742b27435 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp @@ -37,10 +37,21 @@ #include "cafPdmUiItem.h" #include "cafPdmUiEditorHandle.h" +#include "cafPdmPtrField.h" namespace caf { + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmOptionItemInfo::PdmOptionItemInfo(QString anOptionUiText, caf::PdmObjectHandle* obj, bool anIsDimmed /*= false*/, QIcon anIcon /*= QIcon()*/) + : optionUiText(anOptionUiText), isDimmed(anIsDimmed), icon(anIcon) +{ + value = QVariant::fromValue(caf::PdmPointer(obj)); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h index da952663ab..854465e27f 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h @@ -90,6 +90,8 @@ public: : value(aValue), optionUiText(anOptionUiText), isDimmed(anIsDimmed), icon(anIcon) {} + PdmOptionItemInfo(QString anOptionUiText, caf::PdmObjectHandle* obj, bool anIsDimmed = false, QIcon anIcon = QIcon()); + QString optionUiText; bool isDimmed; QIcon icon;