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

Method eventFilter

plugins/eventmonitor/eventmonitor.cpp:331–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331bool EventPropagationListener::eventFilter(QObject *receiver, QEvent *event)
332{
333 if (!s_model)
334 return false;
335
336 if (!s_model->hasEvents())
337 return false;
338
339 EventData &lastEvent = s_model->lastEvent();
340
341 if (lastEvent.eventPtr == event && lastEvent.receiver == receiver) {
342 // this is the same event we already recorded in the event callback
343 return false;
344 }
345 if (!lastEvent.propagatedEvents.isEmpty()
346 && lastEvent.propagatedEvents.last().eventPtr == event) {
347 // this is an event propagated by QML that is already recorded in the event callback
348 return false;
349 }
350
351 if (!shouldBeRecorded(receiver, event))
352 return false;
353
354 if (event->type() != lastEvent.type) {
355 // a new event was created during the propagation
356 EventData newEvent = createEventData(receiver, event);
357 s_model->addEvent(newEvent);
358 s_eventTypeModel->increaseCount(event->type());
359 return false;
360 }
361
362 EventData propagatedEvent = createEventData(receiver, event);
363 lastEvent.propagatedEvents.append(propagatedEvent);
364
365 return false;
366}
367
368
369EventMonitor::EventMonitor(Probe *probe, QObject *parent)

Callers

nothing calls this directly

Calls 8

shouldBeRecordedFunction · 0.85
createEventDataFunction · 0.85
hasEventsMethod · 0.80
increaseCountMethod · 0.80
appendMethod · 0.80
isEmptyMethod · 0.45
typeMethod · 0.45
addEventMethod · 0.45

Tested by

no test coverage detected