#1883 AppFwk : Add const access functions

This commit is contained in:
Magne Sjaastad 2017-09-11 14:51:42 +02:00
parent 13ef8fe076
commit d40a7f11c6
3 changed files with 23 additions and 3 deletions

View File

@ -83,5 +83,23 @@ PdmObjectHandle* PdmUiObjectEditorHandle::pdmObject()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::PdmObjectHandle* PdmUiObjectEditorHandle::pdmObject() const
{
const PdmUiItem* pdmItem = this->pdmItem();
const PdmUiObjectHandle* uiObject = dynamic_cast<const PdmUiObjectHandle*>(pdmItem);
if (uiObject)
{
return uiObject->objectHandle();
}
else
{
return nullptr;
}
}
} //End of namespace caf

View File

@ -64,8 +64,9 @@ public:
QWidget* getOrCreateWidget(QWidget* parent);
QWidget* widget() { return m_widget; }
void setPdmObject(PdmObjectHandle* object);
PdmObjectHandle* pdmObject();
void setPdmObject(PdmObjectHandle* object);
PdmObjectHandle* pdmObject();
const PdmObjectHandle* pdmObject() const;
protected:
virtual QWidget* createWidget(QWidget* parent) = 0;

View File

@ -20,7 +20,8 @@ public:
PdmUiObjectHandle(PdmObjectHandle* owner, bool giveOwnership);
virtual ~PdmUiObjectHandle() { }
PdmObjectHandle* objectHandle() { return m_owner; }
PdmObjectHandle* objectHandle() { return m_owner; }
const PdmObjectHandle* objectHandle() const { return m_owner; }
/// Method to be called from the Ui classes creating Auto Gui to get the group information
/// supplied by the \sa defineUiOrdering method that can be reimplemented