[PyKDE] Modules/gcmodule.c:231: failed assertion `gc->gc.gc_refs != 0'

michael ferraro michael at possibleworlds.com
Thu Dec 11 18:41:00 GMT 2003


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()




More information about the PyQt mailing list