I have encountered this failed assertion while overriding QListView.contentsMousePressEvent QListView.contentsMouseMoveEvent
I was using the "manhattanDistance" between the
e.pos() at the time of the contentsMousePressEvent()
and e.pos() at the time of the contentsMouseMoveEvent()to determine if I should start a Drag. The result of the manhattanDistance
method always returned 0, unless I set the self.xpressPos value to
a constant or multiplied the e.pos() of the contentsMousePressEvent()
by 1 before assigning it self.xpressPos.
def contentsMousePressEvent (self, e):
print "contentsMousePressed"
QListView.contentsMousePressEvent (self.drawingsList, e)
p = self.drawingsList.contentsToViewport (e.pos())
i = self.drawingsList.itemAt (p)
if i:
self.drawingsList.setSelected (i, True)
self.mousePressed = True
self.xpressPos = (e.pos() * 1)
def contentsMouseMoveEvent (self, e): if self.mousePressed: print "pressed:", self.xpressPos.x(), self.xpressPos.y() print "event:", e.pos().x(), e.pos().y() dist = (self.xpressPos - e.pos()).manhattanLength() print "contentsMouseMOVING", dist if dist > QApplication.startDragDistance(): p = self.drawingsList.contentsToViewport (e.pos()) i = self.drawingsList.itemAt (p) print " -- item:", i.text(0).latin1() if i: self.drag = QTextDrag (i.text(0).latin1()) self.drag.dragCopy()
_______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
