MCPcopy Create free account
hub / github.com/MITK/MITK / data

Method data

Modules/ImageStatisticsUI/src/QmitkImageStatisticsTreeModel.cpp:71–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71QVariant 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
102QModelIndex QmitkImageStatisticsTreeModel::index(int row, int column, const QModelIndex &parent) const
103{

Callers

nothing calls this directly

Calls 5

isWIPMethod · 0.80
GetLabelInstanceMethod · 0.80
IsNotNullMethod · 0.80
childCountMethod · 0.45
GetColorMethod · 0.45

Tested by

no test coverage detected