| 165 | } |
| 166 | |
| 167 | QVariant QmitkMAPAlgorithmModel::GetPropertyValue(const map::algorithm::MetaPropertyInfo *pInfo, int role) const |
| 168 | { |
| 169 | if (!m_pMetaInterface) |
| 170 | { |
| 171 | return QVariant(); |
| 172 | } |
| 173 | |
| 174 | map::algorithm::facet::MetaPropertyAlgorithmInterface::MetaPropertyPointer prop = |
| 175 | m_pMetaInterface->getProperty(pInfo); |
| 176 | |
| 177 | if (!prop) |
| 178 | { |
| 179 | return QVariant(); |
| 180 | } |
| 181 | |
| 182 | QVariant result; |
| 183 | |
| 184 | if (role == Qt::DisplayRole) |
| 185 | { |
| 186 | result = QVariant(QString("Error. Cannot unwrap MetaProperty. Name: ") + QString::fromStdString(pInfo->getName())); |
| 187 | } |
| 188 | |
| 189 | if (prop->getMetaPropertyTypeInfo() == typeid(bool)) |
| 190 | { |
| 191 | bool val; |
| 192 | if (map::core::unwrapCastedMetaProperty(prop, val)) |
| 193 | { |
| 194 | result = QVariant(val); |
| 195 | } |
| 196 | } |
| 197 | else if (prop->getMetaPropertyTypeInfo() == typeid(int)) |
| 198 | { |
| 199 | int val; |
| 200 | if (map::core::unwrapCastedMetaProperty(prop, val)) |
| 201 | { |
| 202 | result = QVariant(val); |
| 203 | } |
| 204 | } |
| 205 | else if (prop->getMetaPropertyTypeInfo() == typeid(unsigned int)) |
| 206 | { |
| 207 | unsigned int val; |
| 208 | if (map::core::unwrapCastedMetaProperty(prop, val)) |
| 209 | { |
| 210 | result = QVariant(val); |
| 211 | } |
| 212 | } |
| 213 | else if (prop->getMetaPropertyTypeInfo() == typeid(long)) |
| 214 | { |
| 215 | long val; |
| 216 | if (map::core::unwrapCastedMetaProperty(prop, val)) |
| 217 | { |
| 218 | result = QVariant(qlonglong(val)); |
| 219 | } |
| 220 | } |
| 221 | else if (prop->getMetaPropertyTypeInfo() == typeid(unsigned long)) |
| 222 | { |
| 223 | unsigned long val; |
| 224 | if (map::core::unwrapCastedMetaProperty(prop, val)) |