[Eric] Reimplementing mousePressEvent

Ole Johan Væringstad olejohan.ludde at gmail.com
Sat Feb 27 03:52:28 GMT 2010


Hi guys

in short:

In the following class, how come only the last method appends to the 
TextEdit ?

class MyTextEdit(QTextEdit):
     def __init__(self, parent = None):
         QTextEdit,__init__(self, parent)

     def mousePressEvent(self, event):
         if event.buttons() == Qt.LeftButton and event.modifiers() == 
Qt.ShiftModifier:
             pos = event.pos()
             self.append("(%s,%s)" % (pos.x(), pos.y())

     def mouseReleaseEvent(self, event):
         if event.modifiers() == Qt.ShiftModifier:
             pos = event.pos()
             self.append("(%s,%s)" % (pos.x(), pos.y())

     def mouseMoveEvent(self, event):
         if event.buttons() == Qt.LeftButton and event.modifiers() == 
Qt.ShiftModifier:
             pos = event.pos()
             self.append("(%s,%s)" % (pos.x(), pos.y())

I'm lost,
thanks guys

- Ole Johan


More information about the Eric mailing list