| 69 | } |
| 70 | |
| 71 | QVariant QmitkImageStatisticsTreeModel::data(const QModelIndex &index, int role) const |
| 72 | { |
| 73 | if (!index.isValid()) |
| 74 | return QVariant(); |
| 75 | |
| 76 | QmitkImageStatisticsTreeItem* item = static_cast<QmitkImageStatisticsTreeItem*>(index.internalPointer()); |
| 77 | |
| 78 | if (role == Qt::DisplayRole) |
| 79 | { |
| 80 | return item->data(index.column()); |
| 81 | } |
| 82 | else if (role == Qt::DecorationRole && index.column() == 0) |
| 83 | { |
| 84 | if (item->isWIP() && item->childCount() == 0) |
| 85 | return QVariant(QmitkStyleManager::ThemeIcon(QStringLiteral(":/Qmitk/hourglass-half-solid.svg"))); |
| 86 | else if (!item->isWIP()) |
| 87 | { |
| 88 | auto label = item->GetLabelInstance(); |
| 89 | if (label.IsNotNull()) |
| 90 | { |
| 91 | QPixmap pixmap(QSize(20,20)); |
| 92 | QColor color(label->GetColor().GetRed() * 255, label->GetColor().GetGreen() * 255, label->GetColor().GetBlue() * 255); |
| 93 | pixmap.fill(color); |
| 94 | |
| 95 | return QVariant(QIcon(pixmap)); |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | return QVariant(); |
| 100 | } |
| 101 | |
| 102 | QModelIndex QmitkImageStatisticsTreeModel::index(int row, int column, const QModelIndex &parent) const |
| 103 | { |
nothing calls this directly
no test coverage detected