[PyKDE] QSpinBox wheelEvents
EXT-Harris, Kenneth B
Kenneth.B.Harris at boeing.com
Fri Jun 16 19:08:18 BST 2006
Hi all,
I'm using PyQt 3.3.x on Windows XP, and my task today is to disable
mouse-wheel events for QSpinBoxes. Specifically, it's in a scrolling
view, and I want scroll-wheel events to scroll the whole pane, not
change the QSpinBox value.
My first idea was to override wheelEvent() in a subclass -- I did this
for QComboBox successfully -- but this didn't work for QSpinBoxes.
So I emailed the Qt folks, and they kindly responded with a workaround:
override eventFilter(), and catch wheel-events there. I tried this in
my PyQt3, and it works if your pointer is over the QLineEdit part of the
QSpinBox. Unfortunately, if your pointer is over the 1-px border on the
top/left/bottom sides, or over the little arrows on the right side, the
mousewheel still does its normal thing. I can't figure out how to
receive those events: they don't call either eventFilter() or
wheelEvent().
The Qt guy claimed, however, that it works correctly (with the mouse
anywhere) in Qt, but he hasn't tried PyQt. I haven't confirmed this.
(Apologies. C++ on Windows is really not my forte.)
They also told me that it's possible to simply override wheelEvent() in
Qt 4, as expected. If it turns out the easiest way to fix this in PyQt3
is Really Hard, that's good incentive to try PyQt4. :-)
Is this a limitation of PyQt3? And regardless of whose fault it may be,
is there a workaround?
Thanks!
- Ken
More information about the PyQt
mailing list