[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QGraphicsView view jumping bug
From: Zsolt Ero <zsolt.ero () gmail ! com>
Date: 2012-10-23 22:27:18
Message-ID: CAKw-smCSUqrbwx+F6OVCWaZoDjzW32khWX=4wKbOSRTbW_SPcw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Oh, thanks for that! Was driving me crazy.
Zsolt
On 23 October 2012 22:37, Vincent Vande Vyvre
<vincent.vandevyvre@swing.be>wrote:
> 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 <phil@riverbankcomputing.com
> > <mailto:phil@riverbankcomputing.com>> wrote:
> >
> > On Tue, 23 Oct 2012 20:20:30 +0100, Zsolt Ero <zsolt.ero@gmail.com
> > <mailto:zsolt.ero@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
>
[Attachment #5 (text/html)]
Oh, thanks for that! Was driving me \
crazy.<div><br></div><div>Zsolt</div><div><br></div><div><br><br><div \
class="gmail_quote">On 23 October 2012 22:37, Vincent Vande Vyvre <span \
dir="ltr"><<a href="mailto:vincent.vandevyvre@swing.be" \
target="_blank">vincent.vandevyvre@swing.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Le 23/10/12 22:34, Zsolt Ero a écrit :<br> <div \
class="im">> OK, here is the smallest possible example I could make it. The \
bug<br> > happens when I click on the lower half of the image. Just copy a jpg<br>
> image at the same folder and rename it to "big.jpg".<br>
><br>
> Zsolt<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On 23 October 2012 20:42, Phil Thompson <<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a><br> \
</div><div class="im">> <mailto:<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>>> \
wrote:<br> ><br>
> On Tue, 23 Oct 2012 20:20:30 +0100, Zsolt Ero <<a \
href="mailto:zsolt.ero@gmail.com">zsolt.ero@gmail.com</a><br> </div><div><div \
class="h5">> <mailto:<a \
href="mailto:zsolt.ero@gmail.com">zsolt.ero@gmail.com</a>>> wrote:<br> > \
> I'm having a weird problem: my whole QGraphicsView goes crazy if I<br> > \
> uncomment the following lines in a class (of QtGui.QGraphicsItem):<br> > \
><br> > > if len( self.points ) == 1:<br>
> > rect = QtCore.QRectF( self.points[0].x()-self.radius,<br>
> > self.points[0].y()-self.radius,<br>
> > self.points[0].x()+self.radius,<br>
> > self.points[0].y()+self.radius )<br>
> > return rect<br>
> ><br>
> > Here is the full boundingRect function:<br>
> ><br>
> > def boundingRect( self ):<br>
> > if len( self.points ) == 1:<br>
> > rect = QtCore.QRectF( self.points[0].x()-self.radius,<br>
> > self.points[0].y()-self.radius,<br>
> > self.points[0].x()+self.radius,<br>
> > self.points[0].y()+self.radius )<br>
> > return rect<br>
> ><br>
> > poly = QtGui.QGraphicsPolygonItem( self.polygon )<br>
> > poly.setPen( self.pen )<br>
> > return poly.boundingRect()<br>
> ><br>
> > What happens is that the view moves to top-left corner<br>
> _sometimes_ when<br>
> the<br>
> > rectangle code is run.<br>
> ><br>
> > Here is my full code (just rename an image to big.jpg next to<br>
> the file):<br>
> > <a href="http://pastebin.com/h9tFZmpk" \
target="_blank">http://pastebin.com/h9tFZmpk</a><br> > ><br>
> > I believe it's a bug in PyQt4, can you have a look at it?<br>
><br>
> Not without a short, complete example that demonstrates the problem.<br>
><br>
> Phil<br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> PyQt mailing list <a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> > <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br> You \
must to set the geometry of your scene<br> <br>
self.scene.setSceneRect(0, 0, self.img.width(), self.img.height())<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Vincent V.V.<br>
Oqapy <<a href="https://launchpad.net/oqapy" \
target="_blank">https://launchpad.net/oqapy</a>> . Qarte<br> <<a \
href="https://launchpad.net/qarte" \
target="_blank">https://launchpad.net/qarte</a>> . PaQager <<a \
href="https://launchpad.net/paqager" \
target="_blank">https://launchpad.net/paqager</a>><br> \
_______________________________________________<br> PyQt mailing list <a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br> \
</font></span></blockquote></div><br></div>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic