| 84 | } |
| 85 | |
| 86 | QWidget *QmitkPropertyViewFactory::CreateEditor(mitk::BaseProperty *property, unsigned int type, QWidget *parent) |
| 87 | { |
| 88 | if (!property) |
| 89 | return nullptr; |
| 90 | |
| 91 | if (mitk::StringProperty *prop = dynamic_cast<mitk::StringProperty *>(property)) |
| 92 | { |
| 93 | switch (type) |
| 94 | { |
| 95 | case etON_DEMAND_EDIT: |
| 96 | // a string property |
| 97 | return new QmitkStringPropertyOnDemandEdit(prop, parent); |
| 98 | default: |
| 99 | // a string property |
| 100 | return new QmitkStringPropertyEditor(prop, parent); |
| 101 | } |
| 102 | } |
| 103 | else if (mitk::ColorProperty *prop = dynamic_cast<mitk::ColorProperty *>(property)) |
| 104 | { |
| 105 | // a color property |
| 106 | return new QmitkColorPropertyEditor(prop, parent); |
| 107 | } |
| 108 | else if (mitk::BoolProperty *prop = dynamic_cast<mitk::BoolProperty *>(property)) |
| 109 | { |
| 110 | // a bool property |
| 111 | // TODO fix after refactoring |
| 112 | auto widget = new QmitkBoolPropertyWidget(parent); |
| 113 | widget->SetProperty(prop); |
| 114 | return widget; |
| 115 | } |
| 116 | else if (mitk::IntProperty *prop = dynamic_cast<mitk::IntProperty *>(property)) |
| 117 | { |
| 118 | // a number property |
| 119 | return new QmitkNumberPropertyEditor(prop, parent); |
| 120 | } |
| 121 | else if (mitk::FloatProperty *prop = dynamic_cast<mitk::FloatProperty *>(property)) |
| 122 | { |
| 123 | // a number property |
| 124 | auto pe = new QmitkNumberPropertyEditor(prop, parent); |
| 125 | pe->setDecimalPlaces(2); |
| 126 | return pe; |
| 127 | } |
| 128 | else if (mitk::DoubleProperty *prop = dynamic_cast<mitk::DoubleProperty *>(property)) |
| 129 | { |
| 130 | // a number property |
| 131 | auto pe = new QmitkNumberPropertyEditor(prop, parent); |
| 132 | pe->setDecimalPlaces(2); |
| 133 | return pe; |
| 134 | } |
| 135 | else if (mitk::EnumerationProperty *prop = dynamic_cast<mitk::EnumerationProperty *>(property)) |
| 136 | { |
| 137 | // a enumeration property |
| 138 | auto pe = new QmitkEnumerationPropertyWidget(parent); |
| 139 | pe->SetProperty(prop); |
| 140 | return pe; |
| 141 | } |
| 142 | else |
| 143 | { |
nothing calls this directly
no test coverage detected