<br><br><div class="gmail_quote">On Tue, Sep 20, 2011 at 12:03 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Sep 20, 2011 at 8:55 PM, Michael Lawrence<br>
<<a href="mailto:lawrence.michael@gene.com">lawrence.michael@gene.com</a>> wrote:<br>
> Hi Deepayan,<br>
><br>
> Nice to hear you are back into the Qt stuff. I can indeed reproduce this.<br>
> But not anymore, because I've fixed it.<br>
<br>
</div>Thanks, I can confirm the fix.<br>
<br>
I've decided to try out a different approach, managing the layout in R<br>
as much as possible, and target multiple backends. I'm initially<br>
experimenting with QGraphicsView/Scene, and now I'm getting much<br>
further with that thanks to your fix. At some point I'll start bugging<br>
you about qtpaint as well.<br>
<br></blockquote><div><br>You might want to check out anypaint in the GGobi github. Gabriel Becker (DTL's student) has been doing a lot of work on generic (pure R, backend agnostic) implementations of things like layout. He's implementing anypaint against HTML5/JS in Firefox, via RFirefox. I need to make sure that he is committing his stuff back into github.<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;">
I think there are still problems lurking around. Here is a protection<br>
bug: This gives an error because the gc() causes view$scene() to go<br>
away.<br>
<br>
----<br>
library(qtbase)<br>
<br>
view <- Qt$QGraphicsView()<br>
view$size <- qsize(600, 600)<br>
view$setScene(Qt$QGraphicsScene())<br>
## class(view$scene())<br>
gc()<br>
view$scene() # NULL<br>
view$scene()$clear()<br>
----<br>
<br>
If I uncomment the 'class(view$scene())' then things are OK.<br>
<br></blockquote><div><br>This is just Qt. Neither R nor QGraphicsView keep a reference to the scene. This is why qtpaint sets the parent of the scene to the view, if it does not already have a parent.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
In a more realistic example involving QGraphicsScene (that I haven't<br>
been able to simplify yet), having a gc() keeps things sane, and not<br>
having it leads to errors similar to the ones before, e.g.,<br>
<div class="im"><br>
Error in qinvokeStatic(cl, basename, ...) :<br>
</div> Expected an instance of type 'QColor', not 'QGraphicsLineItem'<br>
Calls: print ... is -> qbrush -> <Anonymous> -> qinvokeStatic -> .Call<br>
<font color="#888888"><br></font></blockquote><div><br>Looking forward to that simplified example.<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>