[Interest] How do Events Cascade to Child Widgets

alexander golks alex at golks.de
Thu Sep 5 08:25:36 CEST 2013


hi,

do you want to just inject or - like me - record and play events for testing
and simulation purpose?

For recording you can override QApplication::eventFilter and store a copy of the
event together with receiver name and class name. Later on you can play all
recorded events by searching for your receiver in allWidgets() and just do a
sendEvent(...).
This will even work for moved/resized qt widgets, for the events are directly
send to the widgets. But you must have put in a name for the objects.

I'm on windows so the next levels are system hooks for recording and SendEvent
or alike for sending events. Though i haven't tried this yet, i except them to 
be received from QApplication as "normal" user events, thus beeing forwarded as
any other event, to a receiver who feels responsible for this event, e.g. a
QLineEdit with focus or a QPushButton at the mouse position.
Doing it this way, you'll surely not get the still-works-with-moved-resized 
feature, though.

alex

-- 
/*
 *  BOFH excuse #24:
 *
 *  network packets travelling uphill (use a carrier pigeon)
 */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130905/c5723dcc/attachment.sig>


More information about the Interest mailing list