<br><br><div class="gmail_quote">On Tue, Sep 28, 2010 at 2:37 AM, Deepayan Sarkar <span dir="ltr"><<a href="mailto:deepayan.sarkar@gmail.com">deepayan.sarkar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Mon, Sep 27, 2010 at 1:48 PM, Michael Lawrence<br>
<<a href="mailto:lawrence.michael@gene.com">lawrence.michael@gene.com</a>> wrote:<br>
<br>
> I've not had enough time to play around with the layout. There have been<br>
> many examples from others where the layout behaves strangely, and I don't<br>
> really have an explanation.<br>
><br>
> The row/col stretch factors are the most obvious way to control the packing<br>
> of the rows and columns. In theory, the grid layout is considering the size<br>
> request of the widget, but in some simple attempts I did not have much luck<br>
> playing with that.<br>
<br>
</div>OK, I will try to see if I can come up with anything.<br>
<br>
[...]<br>
<div class="im"><br>
> There is a cache mode, just pass cache=TRUE to qlayer(). Note that this will<br>
> basically require clip=TRUE, since the cache surface will be maximally<br>
> allocated to the size of the layer. Clipping can cause issues.<br>
<br>
</div>No, I already have cache=TRUE set in qlayer(). Here is a nice simple<br>
example showing the problem:<br>
<br>
-------<br>
<br>
library(qtpaint)<br>
<br>
scene <- qscene()<br>
root <- qlayer(scene)<br>
<br>
points1 <-<br>
qlayer(root,<br>
paintFun = function(item, painter, exposed) {<br>
qdrawGlyph(painter, qglyphCircle(10),<br>
runif(10), runif(10), stroke = NA,<br>
fill = sample(colors(), 1))<br>
},<br>
row = 1L, col = 0L,<br>
cache = TRUE,<br>
limits = qrect(c(0, 1), c(0, 1)))<br>
<br>
v <- qplotView(scene, opengl = FALSE)<br>
<br>
w <- Qt$QTabWidget()<br>
w$addTab(v, "view")<br>
w$addTab((ted <- Qt$QTextEdit()), "text")<br>
w<br>
<br>
-------<br>
<br>
If I now switch between the two tabs (either using mouse or keyboard),<br>
I see the paint function being called every time v becomes visible.<br>
<br>
The following is even more interesting. Start this infinite loop:<br>
<br>
while (TRUE) {<br>
w$currentIndex <- 1<br>
w$update()<br>
Sys.sleep(0.2)<br>
w$currentIndex <- 0<br>
w$update()<br>
Sys.sleep(0.2)<br>
}<br>
<br>
Then while the window with w<br>
<br>
- does not have focus, there is no repaint,<br>
<br>
- does have focus, there's a repaint on every run.<br>
<br>
This is fairly convincing evidence that this is a focus issue, but I<br>
haven't been able to find anything more specific.<br>
<font color="#888888"><br></font></blockquote><div><br>I looked into this a bit. Even if one disables focusing of the view, e.g: <br>v$focusPolicy <- Qt$Qt$NoFocus<br>before adding it to the container, it still repaints when the parent window has focus.<br>
<br>Who knows..<br><br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font color="#888888">
-Deepayan<br>
</font></blockquote></div><br>