[PyQt] events / signals

Eric Frederich eric.frederich at gmail.com
Wed Aug 25 21:43:22 BST 2010


If I find myself subclassing a widget just to get something to happen on an
event am I doing something wrong?
Is there another way to accomplish this?
Is there a way to use an event like a signal in a self.connect?

For example... If I want so do something when a label is clicked I have done
the following and then just connect to the signal I emmit.

class ClickableLabel(QLabel):
    def __init__(self, *args, **kwargs):
        super(ClickableLabel, self).__init__(*args, **kwargs)

    def mousePressEvent(self, event):
        self.emit(SIGNAL("clicked"))


Thanks,
~Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100825/b5ef24f8/attachment.html>


More information about the PyQt mailing list