[PySide] QGraphicsView view jumping bug

Zsolt Ero zsolt.ero at gmail.com
Tue Oct 23 21:25:48 CEST 2012


I'm having a weird problem: my whole QGraphicsView goes crazy if I
uncomment the following lines in a class (of QtGui.QGraphicsItem):

if len( self.points ) == 1:
 rect = QtCore.QRectF( self.points[0].x()-self.radius,
self.points[0].y()-self.radius,
 self.points[0].x()+self.radius,
self.points[0].y()+self.radius )
return rect

Here is the full boundingRect function:

def boundingRect( self ):
if len( self.points ) == 1:
 rect = QtCore.QRectF( self.points[0].x()-self.radius,
self.points[0].y()-self.radius,
 self.points[0].x()+self.radius,
self.points[0].y()+self.radius )
return rect

poly = QtGui.QGraphicsPolygonItem( self.polygon )
poly.setPen( self.pen )
return poly.boundingRect()

What happens is that the view moves to top-left corner _sometimes_ when the
rectangle code is run.

Here is my full code (just rename an image to big.jpg next to the file):
http://pastebin.com/h9tFZmpk

I believe it's a bug in PySide, can you have a look at it?
Also, it's the exact same thing happening in PyQt4. What is happening? Is
it because of some floating point conversion making the view crazy?

Regards,
Zsolt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20121023/a4616b26/attachment.html>


More information about the PySide mailing list