SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::gui::qt::DataWidget Class Referenceabstract

#include <DataWidget.h>

Abstract Interface of a qwidget which allows to edit a data. More...

Inheritance diagram for sofa::gui::qt::DataWidget:

Detailed Description

Abstract Interface of a qwidget which allows to edit a data.

Classes

struct  CreatorArgument
 

Protected Attributes

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

 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 colum. More...
 

Static Public Member Functions

template<class T >
static T * create (T *, const CreatorArgument &arg)
 
static DataWidgetCreateDataWidget (const DataWidget::CreatorArgument &dwarg)
 

Protected Member Functions

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

void WidgetDirty (bool)
 
void DataOwnerDirty (bool)
 
void dataValueChanged (QString dataValueString)
 

Public Slots

void updateDataValue ()
 
void updateWidgetValue ()
 
void setWidgetDirty (bool b=true)
 
void fillFromData ()
 

Attribute details

core::objectmodel::BaseData* sofa::gui::qt::DataWidget::baseData
protected
int sofa::gui::qt::DataWidget::counter
protected
bool sofa::gui::qt::DataWidget::dirty
protected
bool sofa::gui::qt::DataWidget::m_isFilled
protected

tell if DataWidget has been filled from Data true by default

bool sofa::gui::qt::DataWidget::m_toFill
protected

bool to warn action is needed to fill Data, false by default

Constructor details

sofa::gui::qt::DataWidget::DataWidget ( QWidget parent,
const char *  name,
MyData d 
)
sofa::gui::qt::DataWidget::~DataWidget ( )
override

Function details

template<class T >
static T* sofa::gui::qt::DataWidget::create ( T *  ,
const CreatorArgument arg 
)
inlinestatic
DataWidget * sofa::gui::qt::DataWidget::CreateDataWidget ( const DataWidget::CreatorArgument dwarg)
static
void sofa::gui::qt::DataWidget::DataOwnerDirty ( bool  )
signal

Currently this signal is used to reflect the changes of the component name in the sofaListview.

void sofa::gui::qt::DataWidget::dataValueChanged ( QString  dataValueString)
signal
void sofa::gui::qt::DataWidget::fillFromData ( )
slot

slot to be called if DataWidget has not been filled at constructor and need to be filled at first call. Will turn toFill to true only if isFilled == false

const core::objectmodel::BaseData* sofa::gui::qt::DataWidget::getBaseData ( ) const
inline

BaseData pointer accessor function.

core::objectmodel::BaseData* sofa::gui::qt::DataWidget::getBaseData ( )
inline
bool sofa::gui::qt::DataWidget::isDirty ( )
inline
bool sofa::gui::qt::DataWidget::isFilled ( )
inline

return if DataWidget as been filled

void sofa::gui::qt::DataWidget::setData ( MyData d)
virtual
void sofa::gui::qt::DataWidget::setFilled ( bool  value)
inline

method to warn if Data has not been filled at constructor.

void sofa::gui::qt::DataWidget::setWidgetDirty ( bool  b = true)
slot

You call this slot anytime you want to specify that the widget value is out of sync with the underlying data value.

virtual unsigned int sofa::gui::qt::DataWidget::sizeWidget ( )
inlinevirtual
void sofa::gui::qt::DataWidget::updateDataValue ( )
slot

Checks that widget has been edited emit DataOwnerDirty in case the name field has been modified

void sofa::gui::qt::DataWidget::updateVisibility ( )
void sofa::gui::qt::DataWidget::updateWidgetValue ( )
slot

First checks that the widget is not currently being edited checks that the data has changed since the last time the widget has read the data value. ultimately read the data value.

void sofa::gui::qt::DataWidget::WidgetDirty ( bool  )
signal

Emitted each time setWidgetDirty is called. You can also emit it if you want to tell the widget value is out of sync with the underlying data value.