SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::gui::qt::TDataWidget< T > Class Template Reference

#include <DataWidget.h>

This class is basically the same as DataWidget, except that it takes a template parameter so the actual type of Data can be retrieved through the getData() accessor. In most cases you will need to derive from this class to implement the edition of your data in the GUI. More...

Inheritance diagram for sofa::gui::qt::TDataWidget< T >:

Detailed Description

template<class T>
class sofa::gui::qt::TDataWidget< T >

This class is basically the same as DataWidget, except that it takes a template parameter so the actual type of Data can be retrieved through the getData() accessor. In most cases you will need to derive from this class to implement the edition of your data in the GUI.

Protected Attributes

MyTDataTdata { nullptr }
 
- Protected Attributes inherited from sofa::gui::qt::DataWidget
core::objectmodel::BaseDatabaseData
 
bool dirty
 
int counter
 
bool m_isFilled
 tell if DataWidget has been filled from Data true by default More...
 
bool m_toFill
 bool to warn action is needed to fill Data, false by default More...
 

Public Member Functions

 TDataWidget (QWidget *parent, const char *name, core::objectmodel::BaseData *d, const T *object)
 
 TDataWidget (QWidget *parent, const char *name, MyTData *d)
 
sofa::core::objectmodel::Data< T > * getData ()
 
const sofa::core::objectmodel::Data< T > * getData () const
 
virtual void setData (MyTData *d)
 
virtual void setData (MyData *d)
 
- Public Member Functions inherited from sofa::gui::qt::DataWidget
 DataWidget (QWidget *parent, const char *name, MyData *d)
 
 ~DataWidget () override
 
virtual void setData (MyData *d)
 
const core::objectmodel::BaseDatagetBaseData () const
 BaseData pointer accessor function. More...
 
core::objectmodel::BaseDatagetBaseData ()
 
void updateVisibility ()
 
bool isDirty ()
 
bool isFilled ()
 return if DataWidget as been filled More...
 
void setFilled (bool value)
 method to warn if Data has not been filled at constructor. More...
 
virtual bool createWidgets ()=0
 
virtual void setDataReadOnly (bool readOnly)=0
 This method is called after createWidgets to configure whether the created widgets should be read-only. More...
 
virtual unsigned int sizeWidget ()
 Helper method to give a size. More...
 
virtual unsigned int numColumnWidget ()
 Helper method for column. More...
 

Static Public Member Functions

template<class RealObject >
static RealObject * create (RealObject *, CreatorArgument &arg)
 
- Static Public Member Functions inherited from sofa::gui::qt::DataWidget
template<class T >
static T * create (T *, const CreatorArgument &arg)
 
static DataWidgetCreateDataWidget (const DataWidget::CreatorArgument &dwarg)
 

Additional Inherited Members

- Protected Member Functions inherited from sofa::gui::qt::DataWidget
virtual void readFromData ()=0
 The implementation of this method tells how the widget reads the value of the data. More...
 
virtual void writeToData ()=0
 
- Signals inherited from sofa::gui::qt::DataWidget
void WidgetDirty (bool)
 
void DataOwnerDirty (bool)
 
void dataValueChanged (QString dataValueString)
 
- Public Slots inherited from sofa::gui::qt::DataWidget
void updateDataValue ()
 
void updateWidgetValue ()
 
void setWidgetDirty (bool b=true)
 
void fillFromData ()
 

Attribute details

◆ Tdata

template<class T >
MyTData* sofa::gui::qt::TDataWidget< T >::Tdata { nullptr }
protected

Constructor details

◆ TDataWidget() [1/2]

template<class T >
sofa::gui::qt::TDataWidget< T >::TDataWidget ( QWidget parent,
const char name,
core::objectmodel::BaseData d,
const T *  object 
)
inline

◆ TDataWidget() [2/2]

template<class T >
sofa::gui::qt::TDataWidget< T >::TDataWidget ( QWidget parent,
const char name,
MyTData d 
)
inline

Function details

◆ create()

template<class T >
template<class RealObject >
static RealObject* sofa::gui::qt::TDataWidget< T >::create ( RealObject *  ,
CreatorArgument arg 
)
inlinestatic

◆ getData() [1/2]

template<class T >
sofa::core::objectmodel::Data<T>* sofa::gui::qt::TDataWidget< T >::getData ( )
inline

Accessor function. Gives you the actual data instead of a BaseData pointer of it like in getBaseData().

◆ getData() [2/2]

template<class T >
const sofa::core::objectmodel::Data<T>* sofa::gui::qt::TDataWidget< T >::getData ( ) const
inline

◆ setData() [1/2]

template<class T >
void sofa::gui::qt::DataWidget::setData

◆ setData() [2/2]

template<class T >
virtual void sofa::gui::qt::TDataWidget< T >::setData ( MyTData d)
inlinevirtual