tags:

views:

197

answers:

1

I wanna put my custom widget in a QScrollArea, but in my custom widget, i reimplemented wheelEvent(e) and it never gets called. Im fine with the scroll area not having its mouse wheel scrolling functionality, I just need those wheelEvents to call my handler. I tried handling the events out at the level of the main window but I only got them when the scroll widget was at one of its extremes and couldn't have moved any further anyways, i need all of them.

heres a simplified version of my code

class custom(QWidget):
    def __init__(self, parent=None):
        super(custom, self).__init__(parent)
        self.parent = parent

    def wheelEvent(self,event):
        print "Custom Widget's wheelEvent Handler"

class mainw(QMainWindow):
    def __init__(self, parent=None):
        super(mainw, self).__init__(parent)
        scroll = QScrollArea()
        self.tw = thread_widget(scroll)
        scroll.setWidget(self.tw)
        self.setCentralWidget(scroll)

    def wheelEvent(self,event):
        print "Main Window's wheelEvent Handler"

can someone explain to me how it is determined which event handler gets the events in this situation?

A: 

I figured out that its got something to do with the installEventFilter method of QObject, but I couldn't get the example to work so I said to hell with this and changed my plan completely.

problem solved

Nathan