[PySide] how to overwrite wheelEvent for QScrollBar?

Frank Rueter | OHUfx frank at ohufx.com
Wed Dec 23 05:25:12 CET 2015


Hi everybody,
quick Christmas question:

I am trying to re-implement a QScrollBar's wheelEvent to change it's 
delta but I just can't get it right for some reason. It kinda feels like 
a bug to me but am not sure (using PySide 1.0.9).

Below is a stripped down version of what I'm trying to do. 
PageScroller().wheelEvent() never seems to be fired (though the wheel 
does scroll the bar).
Does anybody have an idea what I'm doing wrong?

Cheers,
frank

class PageScroller(QScrollBar):
     '''Scroll widget for tool page'''

     def __init__(self, parent=None):
         super(PageScroller, self).__init__(parent)

     def wheelEvent(self, event):
         print 'received wheel event'


if __name__ == '__main__':
     def testSlot(i):
         print 'Current index changed:', i

     app = QApplication(sys.argv)
     mainWindow = QWidget()
     layout = QVBoxLayout(mainWindow)
     s = PageScroller(mainWindow)
     layout.addWidget(s)
     mainWindow.show()

     sys.exit(app.exec_())



-- 
ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation 
and consulting <http://ohufx.com/index.php/vfx-customising>* *

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20151223/d37f9d95/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ohufxLogo_50x50.png
Type: image/png
Size: 2666 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20151223/d37f9d95/attachment.png>


More information about the PySide mailing list