|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
Records which objects receive the events the input tools inject. More...
#include <inputtools_p.h>
Classes | |
| struct | Chain |
| One injected event and the objects it reached. More... | |
Public Member Functions | |
| DeliveryRecorder (const QObject *target=nullptr) | |
Starts recording; target (optional) is the object the tool aimed at. | |
| ~DeliveryRecorder () override | |
| Stops recording. | |
| QString | firstChainEvent () const |
| What the first recorded chain was: "press", "wheel event", "key" ("press" if none). | |
| bool | firstChainReachedTarget () const |
| Whether the first chain (the first press) reached the target or something inside it. | |
| QString | report () const |
| The report: one line per run of identical chains, e.g. | |
| bool | eventFilter (QObject *receiver, QEvent *event) override |
Records receiver if event is one of the recorded types. | |
Static Public Member Functions | |
| static void | mark (QEvent::Type type) |
Starts a new chain for an injected event of type (no-op without a recorder). | |
Private Attributes | |
| DeliveryRecorder * | m_previous = nullptr |
| The recorder this one hides, if nested. | |
| const QObject * | m_target = nullptr |
| Compared by address only, never dereferenced. | |
| QList< Chain > | m_chains |
| One per injected event. | |
| qsizetype | m_count = 0 |
| Deliveries recorded so far. | |
Static Private Attributes | |
| static DeliveryRecorder * | s_current = nullptr |
| The innermost live recorder. | |
Records which objects receive the events the input tools inject.
While it exists it is an application event filter. Those see every event QCoreApplication delivers in the main thread, including each step when Qt Widgets passes an ignored event on to the parent widget, and when Qt Quick offers an event to one item after another. Qt only offers an event to the next object when the previous one ignored it, so in each chain every object but the last ignored the event. (The last one accepted it, or was the last candidate.) Windows are left out: every event reaches its window first.
The tools call mark() before injecting each event, which starts a new chain. Only the "primary" event types are recorded (presses, wheel, key presses and shortcuts), and only main-thread objects, which is all an application filter sees. Receivers are described when the event arrives, so a receiver that is deleted by its own handler is still reported correctly.
|
inline |
The report: one line per run of identical chains, e.g.
"press, release: @0x1 QLabel#toast -> @0x2 QWidget#central".