| 52 | } |
| 53 | |
| 54 | QVariant QmitkMAPAlgorithmModel::data(const QModelIndex &index, int role) const |
| 55 | { |
| 56 | if (!index.isValid()) |
| 57 | return QVariant(); |
| 58 | |
| 59 | if (!m_pMetaInterface) |
| 60 | { |
| 61 | return QVariant(); |
| 62 | } |
| 63 | |
| 64 | QVariant result; |
| 65 | |
| 66 | if (index.row() < static_cast<int>(m_MetaProperties.size())) |
| 67 | { |
| 68 | map::algorithm::MetaPropertyInfo *pInfo = m_MetaProperties[index.row()]; |
| 69 | |
| 70 | switch (index.column()) |
| 71 | { |
| 72 | case 0: |
| 73 | if (Qt::DisplayRole == role && index.row() < static_cast<int>(m_MetaProperties.size())) |
| 74 | { |
| 75 | result = QVariant(pInfo->getName().c_str()); |
| 76 | } |
| 77 | break; |
| 78 | case 1: |
| 79 | if (Qt::DisplayRole == role && !pInfo->isReadable()) |
| 80 | { |
| 81 | result = QVariant("value is not accessible"); |
| 82 | } |
| 83 | else if (pInfo->isReadable() && (Qt::DisplayRole == role || (Qt::EditRole == role && pInfo->isWritable()))) |
| 84 | { // should also be readable to be sensible editable in the GUI |
| 85 | result = GetPropertyValue(pInfo, role); |
| 86 | } |
| 87 | break; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | return result; |
| 92 | } |
| 93 | |
| 94 | Qt::ItemFlags QmitkMAPAlgorithmModel::flags(const QModelIndex &index) const |
| 95 | { |
no test coverage detected