Unsolved PyQt5 Alternative to setHandlesChildEvents
-
Hello,
I have been porting a PyQt4 application to use PyQt5. Everything seems to work fine apart from one thing: setHandlesChildEvents is now obsolete with QGraphicsItemGroup meaning I can no longer pick up on click events on my items within a group.
What is the alternative approach with PyQt5? I have tried replacing it with self.MyGroup.setFiltersChildEvents(False) but this has no effect.
Thanks for any guidance,
JimboMonkey
-
Hi,
That's likely a question you should rather ask the PyQt folks. They have a mailing list.
-
Ok, thank you. I have subscribed to their mailing list and will post my question there.
I believe my question also relates to C++ Qt as well though as I found out about the obsolescence from the documentation pages (http://doc.qt.io/qt-4.8/qgraphicsitem-obsolete.html). So if anyone knows the answer for C++ let me know.
Thanks,
Jimbo
-
I haven't worked with graphics items but...
http://www.qtcentre.org/threads/66799-setHandlesChildEvents()-obsolete
https://bugreports.qt.io/browse/QTBUG-6861They seem relevant, perhaps they will be useful. It does seem that the issue and solution are not related to Python specifically.
Cheers,
-kyle -
Thanks Kyle.
In the end I solved it by subclassing my qgraphicsitemgroup and adding a sceneEventFilter.
This appears to be the approach the C++ people take