SOFA API  3ea83cbd
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

◆ baseData

core::objectmodel::BaseData* sofa::gui::qt::DataWidget::baseData
protected

◆ counter

int sofa::gui::qt::DataWidget::counter
protected

◆ dirty

bool sofa::gui::qt::DataWidget::dirty
protected

◆ m_isFilled

bool sofa::gui::qt::DataWidget::m_isFilled
protected

tell if DataWidget has been filled from Data true by default

◆ m_toFill

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

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

Constructor details

◆ DataWidget()

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

◆ ~DataWidget()

sofa::gui::qt::DataWidget::~DataWidget ( )
override

Function details

◆ create()

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

◆ CreateDataWidget()

DataWidget * sofa::gui::qt::DataWidget::CreateDataWidget ( const DataWidget::CreatorArgument dwarg)
static

◆ createWidgets()

◆ DataOwnerDirty

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

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

◆ dataValueChanged

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

◆ fillFromData

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

◆ getBaseData() [1/2]

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

◆ getBaseData() [2/2]

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

BaseData pointer accessor function.

◆ isDirty()

bool sofa::gui::qt::DataWidget::isDirty ( )
inline

◆ isFilled()

bool sofa::gui::qt::DataWidget::isFilled ( )
inline

return if DataWidget as been filled

◆ numColumnWidget()

◆ readFromData()

◆ setData()

void sofa::gui::qt::DataWidget::setData ( MyData d)
virtual

◆ setDataReadOnly()

◆ setFilled()

void sofa::gui::qt::DataWidget::setFilled ( bool  value)
inline

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

◆ setWidgetDirty

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.

◆ sizeWidget()

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

◆ updateDataValue

void sofa::gui::qt::DataWidget::updateDataValue ( )
slot

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

◆ updateVisibility()

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

◆ updateWidgetValue

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.

◆ WidgetDirty

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.

◆ writeToData()