Hi,
next problem: while substraction or addition of two QPoints should
work, it won't, at least not with
sip version: 4.1.1
Qt version: 3.2.1
PyQt version: 3.13
Any ideas?
Cheers,
Pete
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from qt import *
class eventTest(QPushButton):
def __init__(self, *args):
QPushButton.__init__(self, "Drag me!", *args)
self.pressPos = None
def mousePressEvent(self, e):
self.pressPos = p = e.pos()
print "mousePressEvent:", p.x(), p.y()
def mouseMoveEvent(self, e):
if self.pressPos:
p = e.pos()
print "mouseMoveEvent pos:", p.x(), p.y()
p = self.pressPos - p
print "Dist:", p.x(), p.y(), p.manhattanLength()
p = self.pressPos
p -= e.pos()
print "Dist:", p.x(), p.y(), p.manhattanLength()
p = self.pressPos + p
print "Add:", p.x(), p.y(), p.manhattanLength()
else:
print "mouseMoveEvent ignored"
def mouseReleaseEvent(self, e):
print "mouseReleaseEvent"
self.pressPos = None
if __name__ == "__main__":
app = QApplication(sys.argv)
win = eventTest(None)
app.setMainWidget(win)
win.show()
ret = app.exec_loop()
sys.exit(ret)
_______________________________________________
PyKDE mailing list [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde