[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">&lt;<a href="mailto:vincent.vandevyvre@swing.be" \
target="_blank">vincent.vandevyvre@swing.be</a>&gt;</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">&gt; OK, here is the smallest possible example I could make it. The \
bug<br> &gt; happens when I click on the lower half of the image. Just copy a jpg<br>
&gt; image at the same folder and rename it to &quot;big.jpg&quot;.<br>
&gt;<br>
&gt; Zsolt<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 23 October 2012 20:42, Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a><br> \
</div><div class="im">&gt; &lt;mailto:<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt;&gt; \
wrote:<br> &gt;<br>
&gt;     On Tue, 23 Oct 2012 20:20:30 +0100, Zsolt Ero &lt;<a \
href="mailto:zsolt.ero@gmail.com">zsolt.ero@gmail.com</a><br> </div><div><div \
class="h5">&gt;     &lt;mailto:<a \
href="mailto:zsolt.ero@gmail.com">zsolt.ero@gmail.com</a>&gt;&gt; wrote:<br> &gt;     \
&gt; I&#39;m having a weird problem: my whole QGraphicsView goes crazy if I<br> &gt;  \
&gt; uncomment the following lines in a class (of QtGui.QGraphicsItem):<br> &gt;     \
&gt;<br> &gt;     &gt; if len( self.points ) == 1:<br>
&gt;     &gt;  rect = QtCore.QRectF( self.points[0].x()-self.radius,<br>
&gt;     &gt; self.points[0].y()-self.radius,<br>
&gt;     &gt;  self.points[0].x()+self.radius,<br>
&gt;     &gt; self.points[0].y()+self.radius )<br>
&gt;     &gt;  return rect<br>
&gt;     &gt;<br>
&gt;     &gt; Here is the full boundingRect function:<br>
&gt;     &gt;<br>
&gt;     &gt; def boundingRect( self ):<br>
&gt;     &gt;  if len( self.points ) == 1:<br>
&gt;     &gt; rect = QtCore.QRectF( self.points[0].x()-self.radius,<br>
&gt;     &gt;  self.points[0].y()-self.radius,<br>
&gt;     &gt; self.points[0].x()+self.radius,<br>
&gt;     &gt;  self.points[0].y()+self.radius )<br>
&gt;     &gt; return rect<br>
&gt;     &gt;<br>
&gt;     &gt; poly = QtGui.QGraphicsPolygonItem( self.polygon )<br>
&gt;     &gt;  poly.setPen( self.pen )<br>
&gt;     &gt; return poly.boundingRect()<br>
&gt;     &gt;<br>
&gt;     &gt; What happens is that the view moves to top-left corner<br>
&gt;     _sometimes_ when<br>
&gt;     the<br>
&gt;     &gt; rectangle code is run.<br>
&gt;     &gt;<br>
&gt;     &gt; Here is my full code (just rename an image to big.jpg next to<br>
&gt;     the file):<br>
&gt;     &gt; <a href="http://pastebin.com/h9tFZmpk" \
target="_blank">http://pastebin.com/h9tFZmpk</a><br> &gt;     &gt;<br>
&gt;     &gt; I believe it&#39;s a bug in PyQt4, can you have a look at it?<br>
&gt;<br>
&gt;     Not without a short, complete example that demonstrates the problem.<br>
&gt;<br>
&gt;     Phil<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; PyQt mailing list    <a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> &gt; <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 &lt;<a href="https://launchpad.net/oqapy" \
target="_blank">https://launchpad.net/oqapy</a>&gt; . Qarte<br> &lt;<a \
href="https://launchpad.net/qarte" \
target="_blank">https://launchpad.net/qarte</a>&gt; . PaQager &lt;<a \
href="https://launchpad.net/paqager" \
target="_blank">https://launchpad.net/paqager</a>&gt;<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