Le 23/10/12 22:34, Zsolt Ero a écrit : > OK, here is the smallest possible example I could make it. The bug > happens when I click on the lower half of the image. Just copy a jpg > image at the same folder and rename it to "big.jpg". > > Zsolt > > > > > > > > On 23 October 2012 20:42, Phil Thompson <p...@riverbankcomputing.com > <mailto:p...@riverbankcomputing.com>> wrote: > > On Tue, 23 Oct 2012 20:20:30 +0100, Zsolt Ero <zsolt....@gmail.com > <mailto:zsolt....@gmail.com>> wrote: > > 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 PyQt4, can you have a look at it? > > Not without a short, complete example that demonstrates the problem. > > Phil > > > > > _______________________________________________ > PyQt mailing list PyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt You must to set the geometry of your scene
self.scene.setSceneRect(0, 0, self.img.width(), self.img.height()) -- Vincent V.V. Oqapy <https://launchpad.net/oqapy> . Qarte <https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager> _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt