| 129 | } |
| 130 | |
| 131 | QVariant QmitkDataStorageLayerStackModel::data(const QModelIndex& index, int role) const |
| 132 | { |
| 133 | if (!index.isValid() || index.model() != this) |
| 134 | { |
| 135 | return QVariant(); |
| 136 | } |
| 137 | |
| 138 | if ((index.row()) < 0 || index.row() >= static_cast<int>(m_TempLayerStack.size())) |
| 139 | { |
| 140 | return QVariant(); |
| 141 | } |
| 142 | |
| 143 | RenderWindowLayerUtilities::LayerStack::const_iterator layerStackIt = m_TempLayerStack.begin(); |
| 144 | std::advance(layerStackIt, index.row()); |
| 145 | mitk::DataNode* dataNode = layerStackIt->second; |
| 146 | if (Qt::CheckStateRole == role && 0 == index.column()) |
| 147 | { |
| 148 | bool visibility = false; |
| 149 | dataNode->GetVisibility(visibility, m_BaseRenderer.Lock()); |
| 150 | if (visibility) |
| 151 | { |
| 152 | return Qt::Checked; |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | return Qt::Unchecked; |
| 157 | } |
| 158 | } |
| 159 | else if (Qt::DisplayRole == role && 1 == index.column()) |
| 160 | { |
| 161 | return QVariant(QString::fromStdString(dataNode->GetName())); |
| 162 | } |
| 163 | else if (Qt::ToolTipRole == role) |
| 164 | { |
| 165 | if (0 == index.column()) |
| 166 | { |
| 167 | return QVariant("Show/hide data node."); |
| 168 | } |
| 169 | else if (1 == index.column()) |
| 170 | { |
| 171 | return QVariant("Name of the data node."); |
| 172 | } |
| 173 | } |
| 174 | else if (QmitkDataNodeRole == role) |
| 175 | { |
| 176 | return QVariant::fromValue<mitk::DataNode::Pointer>(mitk::DataNode::Pointer(dataNode)); |
| 177 | } |
| 178 | else if (QmitkDataNodeRawPointerRole == role) |
| 179 | { |
| 180 | return QVariant::fromValue<mitk::DataNode*>(dataNode); |
| 181 | } |
| 182 | |
| 183 | return QVariant(); |
| 184 | } |
| 185 | |
| 186 | bool QmitkDataStorageLayerStackModel::setData(const QModelIndex &index, const QVariant &value, int role /*= Qt::EditRole*/) |
| 187 | { |
no test coverage detected