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

Method findTimerInfo

plugins/timertop/timermodel.cpp:175–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175const TimerIdInfo *TimerModel::findTimerInfo(const QModelIndex &index) const
176{
177 if (index.row() < m_sourceModel->rowCount()) {
178 const QModelIndex sourceIndex = m_sourceModel->index(index.row(), 0);
179 QObject *const timerObject = sourceIndex.data(ObjectModel::ObjectRole).value<QObject *>();
180
181 // The object might have already be deleted even if our index is valid
182 if (!timerObject)
183 return nullptr;
184
185 const TimerId id = TimerId(timerObject);
186 auto it = m_timersInfo.find(id);
187
188 if (it == m_timersInfo.end()) {
189 it = m_timersInfo.insert(id, TimerIdInfo());
190 // safe, as timerObject has been validated by the source model
191 it.value().update(id);
192 }
193
194 return &it.value();
195 }
196 if (index.row() < m_sourceModel->rowCount() + m_freeTimersInfo.size()) {
197 return &m_freeTimersInfo[index.row() - m_sourceModel->rowCount()];
198 }
199
200 return nullptr;
201}
202
203bool TimerModel::canHandleCaller(QObject *caller, int methodIndex) const
204{

Callers

nothing calls this directly

Calls 11

TimerIdClass · 0.85
TimerIdInfoClass · 0.85
rowMethod · 0.80
endMethod · 0.80
rowCountMethod · 0.45
indexMethod · 0.45
dataMethod · 0.45
insertMethod · 0.45
updateMethod · 0.45
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected