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

Method data

Modules/QtWidgetsExt/src/QmitkModuleTableModel.cpp:66–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66QVariant QmitkModuleTableModel::data(const QModelIndex &index, int role) const
67{
68 if (!index.isValid())
69 return QVariant();
70
71 if (role == Qt::DisplayRole)
72 {
73 us::Module *module = d->modules[index.row() + 1];
74 switch (index.column())
75 {
76 case 0:
77 return QVariant::fromValue(static_cast<int>(module->GetModuleId()));
78 case 1:
79 return QString::fromStdString(module->GetName());
80 case 2:
81 return QString::fromStdString(module->GetVersion().ToString());
82 case 3:
83 return QString::fromStdString(module->GetLocation());
84 }
85 }
86 else if (role == Qt::ForegroundRole)
87 {
88 us::Module *module = d->modules[index.row() + 1];
89 if (!module->IsLoaded())
90 {
91 return QBrush(Qt::gray);
92 }
93 }
94 else if (role == Qt::ToolTipRole)
95 {
96 us::Module *module = d->modules[index.row() + 1];
97 QString id = QString::number(module->GetModuleId());
98 QString name = QString::fromStdString(module->GetName());
99 QString version = QString::fromStdString(module->GetVersion().ToString());
100 QString location = QString::fromStdString(module->GetLocation());
101 QString state = module->IsLoaded() ? "Loaded" : "Unloaded";
102
103 QString tooltip = "Id: %1\nName: %2\nVersion: %3\nLocation: %7\nState: %9";
104
105 return tooltip.arg(id, name, version, location, state);
106 }
107 return QVariant();
108}
109
110QVariant QmitkModuleTableModel::headerData(int section, Qt::Orientation orientation, int role) const
111{

Callers

nothing calls this directly

Calls 7

GetModuleIdMethod · 0.80
GetVersionMethod · 0.80
rowMethod · 0.45
GetNameMethod · 0.45
ToStringMethod · 0.45
GetLocationMethod · 0.45
IsLoadedMethod · 0.45

Tested by

no test coverage detected