[PySide] Distinguishing QEvents originating in PySide2 from those originating in C++

Stephen Morris s-morris at n-eos.com
Tue Mar 10 14:27:05 CET 2020

We're writing an application in which we create numerous QWidgets of our own in C++, while also embedding a Python interpreter which allows customers to write and execute their own scripts using PySide2 from within our application.

When they write PySide2 scripts which open up windows, and those windows contain widgets which create QEvents, they are processed as part of the same main event loop as our C++-generated windows.

It would be very helpful if we could apply an event filter which would allow us to intercept events that originate from the PySIde2-generated windows, to make us aware if end-users trigger events from their PySide2 windows which may affect the state of our application's data.

Is there a way of doing this? Preferably without having to override QCoreApplication::notify(), since that approach is deprecated in Qt6.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20200310/92626c72/attachment.html>

More information about the PySide mailing list