#include <QmitkPropertyViewFactory.h>
Public Types | |
| enum | ViewTypes { vtDEFAULT = 0 } |
| enum | EditorTypes { etDEFAULT = 0, etALWAYS_EDIT = 1, etON_DEMAND_EDIT = 2 } |
Public Member Functions | |
| QWidget * | CreateView (const mitk::BaseProperty *property, unsigned int type=0, QWidget *parent=0) |
| QWidget * | CreateEditor (mitk::BaseProperty *property, unsigned int type=0, QWidget *parent=0) |
Static Public Member Functions | |
| static QmitkPropertyViewFactory * | GetInstance () |
Protected Member Functions | |
| QmitkPropertyViewFactory () | |
| ~QmitkPropertyViewFactory () | |
Definition at line 23 of file QmitkPropertyViewFactory.h.
Definition at line 28 of file QmitkPropertyViewFactory.h.
{ etDEFAULT = 0, etALWAYS_EDIT = 1, etON_DEMAND_EDIT = 2 };
| QmitkPropertyViewFactory::QmitkPropertyViewFactory | ( | ) | [protected] |
Definition at line 38 of file QmitkPropertyViewFactory.cpp.
{
}
| QmitkPropertyViewFactory::~QmitkPropertyViewFactory | ( | ) | [protected] |
Definition at line 42 of file QmitkPropertyViewFactory.cpp.
{
}
| QWidget * QmitkPropertyViewFactory::CreateEditor | ( | mitk::BaseProperty * | property, |
| unsigned int | type = 0, |
||
| QWidget * | parent = 0 |
||
| ) |
Definition at line 93 of file QmitkPropertyViewFactory.cpp.
References etON_DEMAND_EDIT, and QmitkNumberPropertyEditor::setDecimalPlaces().
{
if (!property) return NULL;
if ( mitk::StringProperty* prop = dynamic_cast<mitk::StringProperty*>(property) )
{
switch (type)
{
case etON_DEMAND_EDIT:
// a string property
return new QmitkStringPropertyOnDemandEdit(prop, parent);
default:
// a string property
return new QmitkStringPropertyEditor(prop, parent);
}
}
else if ( mitk::ColorProperty* prop = dynamic_cast<mitk::ColorProperty*>(property) )
{
// a color property
return new QmitkColorPropertyEditor(prop, parent);
}
else if ( mitk::BoolProperty* prop = dynamic_cast<mitk::BoolProperty*>(property) )
{
// a bool property
return new QmitkBoolPropertyEditor(prop, parent);
}
/*
else if ( mitk::GenericProperty<short>* prop = dynamic_cast<mitk::GenericProperty<short>*>(property) )
{
// a number property
return new QmitkNumberPropertyEditor(prop, parent, name);
}
*/
else if ( mitk::IntProperty* prop = dynamic_cast<mitk::IntProperty*>(property) )
{
// a number property
return new QmitkNumberPropertyEditor(prop, parent);
}
else if ( mitk::FloatProperty* prop = dynamic_cast<mitk::FloatProperty*>(property) )
{
// a number property
QmitkNumberPropertyEditor* pe = new QmitkNumberPropertyEditor(prop, parent);
pe->setDecimalPlaces(2);
return pe;
}
else if ( mitk::DoubleProperty* prop = dynamic_cast<mitk::DoubleProperty*>(property) )
{
// a number property
QmitkNumberPropertyEditor* pe = new QmitkNumberPropertyEditor(prop, parent);
pe->setDecimalPlaces(2);
return pe;
}
else
{
// some unknown property --> no editor possible
return NULL;
}
}
| QWidget * QmitkPropertyViewFactory::CreateView | ( | const mitk::BaseProperty * | property, |
| unsigned int | type = 0, |
||
| QWidget * | parent = 0 |
||
| ) |
Views and editors are created via operator new. After creation they belong to the caller of CreateView()/CreateEditor(), i.e. the caller has to ensure, that the objects are properly deleted!
Definition at line 45 of file QmitkPropertyViewFactory.cpp.
{
if ( const mitk::StringProperty* prop = dynamic_cast<const mitk::StringProperty*>(property) )
{
// a string property
return new QmitkStringPropertyView(prop, parent);
}
else if ( const mitk::ColorProperty* prop = dynamic_cast<const mitk::ColorProperty*>(property) )
{
// a color property
return new QmitkColorPropertyView(prop, parent);
}
else if ( const mitk::BoolProperty* prop = dynamic_cast<const mitk::BoolProperty*>(property) )
{
// a bool property
return new QmitkBoolPropertyView(prop, parent);
}
/*
else if ( const mitk::GenericProperty<short>* prop = dynamic_cast<const mitk::GenericProperty<short>*>(property) )
{
// a number property
return new QmitkNumberPropertyView(prop, parent, name);
}
*/
else if ( const mitk::IntProperty* prop = dynamic_cast<const mitk::IntProperty*>(property) )
{
// a number property
return new QmitkNumberPropertyView(prop, parent);
}
else if ( const mitk::FloatProperty* prop = dynamic_cast<const mitk::FloatProperty*>(property) )
{
// a number property
return new QmitkNumberPropertyView(prop, parent);
}
else if ( const mitk::DoubleProperty* prop = dynamic_cast<const mitk::DoubleProperty*>(property) )
{
// a number property
return new QmitkNumberPropertyView(prop, parent);
}
else if ( property != NULL )
{
// some unknown property --> use the GetValueAsString() method to
return new QmitkBasePropertyView(prop, parent);
}
return NULL;
}
| QmitkPropertyViewFactory * QmitkPropertyViewFactory::GetInstance | ( | ) | [static] |
Definition at line 32 of file QmitkPropertyViewFactory.cpp.
{
static QmitkPropertyViewFactory instance;
return &instance;
}
1.7.2