[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Problem with colored rectangles
From:       shi dingan <shi.dingan () gmail ! com>
Date:       2011-02-20 0:59:54
Message-ID: AANLkTikosSc7j6Yx5N21fvoiSpG=q4Y_mgyOd=D-yoJp () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Ok, it works on my simple test case.
I did not know the setZValue method.
Now I'll use it in my "real" application.

Thx a lot,
Marc.

2011/2/20 David Boddie <david@boddie.org.uk>

> On Sat Feb 19 22:22:10 GMT 2011, shi dingan wrote:
>
> > I have a problem with my code when I try to draw two rectangles with
> > overlap.
> > I draw a red one, then a green with a small part of it overlapping the
> red
> > rectangle.
> > But when I refresh the scene, I have a random behavior, that is,
> sometimes
> > only the red rectangle appears and sometimes both rectangle appear.
> > Is it a normal behavior?
>
> Really, both should appear. I think the confusion arises because the green
> one lies within the space occupied by the red one.
>
> > I was expecting to see always both rectangle since the
> > red one is always the first one added to the scene...
>
> Sometimes the red one appears on top of the green one. Because it covers
> the same area as the green rectangle, it looks like only the red rectangle
> is added to the scene. To make the green rectangle appear on top, set a
> Z value for each of them, but make sure the green rectangle has a higher
> value than the red, like this:
>
>  zone1.setZValue(0)
>  zone2.setZValue(1)
>
> David
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

[Attachment #5 (text/html)]

Ok, it works on my simple test case.<br>I did not know the setZValue method.<br>Now \
I&#39;ll use it in my &quot;real&quot; application.<br><br>Thx a \
lot,<br>Marc.<br><br><div class="gmail_quote">2011/2/20 David Boddie <span \
dir="ltr">&lt;<a href="mailto:david@boddie.org.uk" \
target="_blank">david@boddie.org.uk</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px \
solid rgb(204, 204, 204); padding-left: 1ex;"><div>On Sat Feb 19 22:22:10 GMT 2011, \
shi dingan wrote:<br> <br>
&gt; I have a problem with my code when I try to draw two rectangles with<br>
&gt; overlap.<br>
&gt; I draw a red one, then a green with a small part of it overlapping the red<br>
&gt; rectangle.<br>
&gt; But when I refresh the scene, I have a random behavior, that is, sometimes<br>
&gt; only the red rectangle appears and sometimes both rectangle appear.<br>
&gt; Is it a normal behavior?<br>
<br>
</div>Really, both should appear. I think the confusion arises because the green<br>
one lies within the space occupied by the red one.<br>
<div><br>
&gt; I was expecting to see always both rectangle since the<br>
&gt; red one is always the first one added to the scene...<br>
<br>
</div>Sometimes the red one appears on top of the green one. Because it covers<br>
the same area as the green rectangle, it looks like only the red rectangle<br>
is added to the scene. To make the green rectangle appear on top, set a<br>
Z value for each of them, but make sure the green rectangle has a higher<br>
value than the red, like this:<br>
<br>
  zone1.setZValue(0)<br>
  zone2.setZValue(1)<br>
<br>
David<br>
_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">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> \
</blockquote></div><br>



_______________________________________________
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