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

Method eventNotifyCallback

plugins/timertop/timermodel.cpp:276–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276bool TimerModel::eventNotifyCallback(void *data[])
277{
278 Q_ASSERT(TimerModel::isInitialized());
279
280 /*
281 * data[0] == receiver
282 * data[1] == event
283 * data[2] == bool result ref, what is returned by caller if this function return true
284 * (QCoreApplication::notifyInternal / QCoreApplication::notifyInternal2)
285 */
286 QObject *receiver = static_cast<QObject *>(data[0]);
287 QEvent *event = static_cast<QEvent *>(data[1]);
288 // bool *result = static_cast<bool *>(data[2]);
289
290 if (event->type() == QEvent::Timer) {
291 const QTimerEvent *const timerEvent = static_cast<QTimerEvent *>(event);
292 const QTimer *const timer = qobject_cast<QTimer *>(receiver);
293
294 // If there is a QTimer associated with this timer ID, don't handle it here, it will be handled
295 // by the signal hooks preSignalActivate/postSignalActivate.
296 if (timer && timer->timerId() == timerEvent->timerId()) {
297 return false;
298 }
299
300 {
301 auto timerModel = s_timerModel->data();
302 QMutexLocker locker(&timerModel->m_mutex);
303 const TimerId id(timerEvent->timerId(), receiver);
304 auto it = timerModel->m_gatheredTimersData.find(id);
305
306 if (it == timerModel->m_gatheredTimersData.end()) {
307 it = timerModel->m_gatheredTimersData.insert(id, TimerIdData());
308 }
309
310 const TimeoutEvent timeoutEvent(QTime::currentTime(), -1);
311 // safe, we are called from the receiver thread
312 it.value().update(id, receiver);
313 it.value().addEvent(timeoutEvent);
314
315 timerModel->checkDispatcherStatus(receiver);
316 timerModel->m_triggerPushChangesMethod.invoke(timerModel, Qt::QueuedConnection);
317 }
318 }
319
320 return false;
321}
322
323TimerModel::~TimerModel()
324{

Callers

nothing calls this directly

Calls 10

timerIdMethod · 0.80
endMethod · 0.80
checkDispatcherStatusMethod · 0.80
TimerIdDataClass · 0.70
typeMethod · 0.45
dataMethod · 0.45
insertMethod · 0.45
updateMethod · 0.45
valueMethod · 0.45
addEventMethod · 0.45

Tested by

no test coverage detected