MCPcopy Create free account
hub / github.com/KDAB/GammaRay / data

Method data

launcher/ui/processmodel.cpp:157–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157QVariant ProcessModel::data(const QModelIndex &index, int role) const
158{
159 if (!index.isValid())
160 return QVariant();
161
162 const ProcData &data = m_data.at(index.row());
163
164 if (role == Qt::DisplayRole) {
165 if (index.column() == PIDColumn)
166 return data.ppid;
167 else if (index.column() == NameColumn)
168 return data.image.isEmpty() ? data.name : data.image;
169 else if (index.column() == StateColumn)
170 return data.state;
171 else if (index.column() == UserColumn)
172 return data.user;
173 } else if (role == Qt::ToolTipRole) {
174 const ProbeABI bestABI = ProbeFinder::findBestMatchingABI(data.abi, m_availableABIs);
175 return tr("Name: %1\nPID: %2\nOwner: %3\nQt ABI: %4\nProbe available: %5").arg(data.image.isEmpty() ? data.name : data.image, QString::number(data.ppid), data.user, data.abi.displayString(), bestABI.isValid() ? tr("yes") : tr("no"));
176 } else if (role == PIDRole) {
177 return data.ppid;
178 } else if (role == NameRole) {
179 return data.image.isEmpty() ? data.name : data.image;
180 } else if (role == StateRole) {
181 return data.state;
182 } else if (role == UserRole) {
183 return data.user;
184 } else if (role == ABIRole) {
185 return QVariant::fromValue(data.abi);
186 }
187
188 return QVariant();
189}
190
191int ProcessModel::columnCount(const QModelIndex &parent) const
192{

Callers 7

processInfoFunction · 0.45
lessThanMethod · 0.45
pidMethod · 0.45
selectABIMethod · 0.45
flagsMethod · 0.45
instanceSelectedMethod · 0.45

Calls 7

findBestMatchingABIFunction · 0.85
rowMethod · 0.80
columnMethod · 0.80
QVariantClass · 0.50
isValidMethod · 0.45
isEmptyMethod · 0.45
displayStringMethod · 0.45

Tested by

no test coverage detected