[PyKDE] QSpinBox wheelEvents

EXT-Harris, Kenneth B Kenneth.B.Harris at boeing.com
Fri Jun 23 03:54:44 BST 2006


Hi Pete,

I tried your example, and it looked promising.  I even tried changing
one widget to a QSpinBox (the widget I'm using), and it still recorded
all wheel events.  That's good!

When I tried adding an eventFilter to the parent widget (of the
QSpinBox) on my own project, I got a rather strange result.  I have a
QScrollView with my widgets.  (Kind of like form controls in a web
browser.  It's not a web browser, but the content is dynamically
generated like that.)  When I attach an eventFilter to the QScrollView,
only the top-left 20x20px or so gets drawn -- even if the eventFilter is
simply "return False"!  Truly bizarre.

Your ideas did lead to a solution, though: a global event filter (as in
your example) that watches for QWheelEvent where obj.parent() is a
QSpinBox.  For some reason, it sends events from a plain QObject
instance.  I can post an example (120 lines) that shows my 3 failed
approaches and the one that worked, if anybody likes.  :-)

> It's all a matter of where you install the event filter, and 
> how much dirty tricks you can stand ;-). See attached script 
> et.py as a starter.

I was hoping for "no dirty tricks at all", or "692 dirty tricks, so I
have an excuse to upgrade to PyQt4".  :-)

Thanks!


- Ken




More information about the PyQt mailing list