MCPcopy Create free account
hub / github.com/Vector35/debugger / data

Method data

ui/attachprocess.cpp:77–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76
77QVariant ProcessListModel::data(const QModelIndex& index, int role) const
78{
79 if (index.column() >= columnCount() || (size_t)index.row() >= m_items.size())
80 return QVariant();
81
82 ProcessItem* item = static_cast<ProcessItem*>(index.internalPointer());
83 if (!item)
84 return QVariant();
85
86 if ((role != Qt::DisplayRole) && (role != Qt::SizeHintRole) && (role != SortFilterRole))
87 return QVariant();
88
89 switch (index.column())
90 {
91 case ProcessListModel::PidColumn:
92 {
93 QString text = QString::asprintf("%d", item->pid());
94 if (role == Qt::SizeHintRole)
95 return QVariant((qulonglong)text.size());
96
97 return QVariant(text);
98 }
99 case ProcessListModel::ProcessNameColumn:
100 {
101 QString text = QString::fromStdString(item->processName());
102 if (role == Qt::SizeHintRole)
103 return QVariant((qulonglong)text.size());
104
105 return QVariant(text);
106 }
107 }
108 return QVariant();
109}
110
111
112QVariant ProcessListModel::headerData(int column, Qt::Orientation orientation, int role) const

Callers 3

paintMethod · 0.45
sizeHintMethod · 0.45
filterAcceptsRowMethod · 0.45

Calls 4

rowMethod · 0.80
sizeMethod · 0.80
pidMethod · 0.80
processNameMethod · 0.80

Tested by

no test coverage detected