<br><br><div class="gmail_quote">On Fri, Nov 13, 2009 at 11:17 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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Nov 13, 2009 at 6:15 AM, Michael Lawrence <<a href="mailto:lawremi@gmail.com">lawremi@gmail.com</a>> wrote:<br>
><br>
><br>
> On Fri, Nov 13, 2009 at 5:56 AM, Deepayan Sarkar <<a href="mailto:deepayan.sarkar@gmail.com">deepayan.sarkar@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi (Michael, mostly),<br>
>><br>
>> I'm at the stage where I'm happy with updates to qtutils, which is<br>
>> basically all R code, using signals etc.<br>
>><br>
>> My next target is qtdevices, i.e., a traditional R graphics device<br>
>> using QGraphicsScene. Is this feasible at this point? I've checked in<br>
>> a few relevant questions in qtbase/questions.txt, the first couple of<br>
>> which would help me plan my next steps:<br>
>><br>
>><br>
>> o Can we use user-written classes (defined in C++) from R yet? e.g.,<br>
>> RSyntaxHighlighter<br>
>><br>
><br>
> Yes, this is possible. Check out, for example, the class wizard demo.<br>
<br>
</div>So you're saying that it should be possible to translate a C++ class<br>
to R, right?<br>
<br></blockquote><div><br>Most likely, yes.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It would also be useful to have an existing C++ class wrapped<br>
directly, as with the Qt classes. How much work is involved in having<br>
that set up? This must be a common enough problem.<br>
<div class="im"><br></div></blockquote><div><br>This is a problem and is a major hang-up for qtpaint. Essentially, we need to generate the smoke metadata/bindings for every class we define in C++. Otherwise, instances of the class are not compatible with Smoke (which is usually important when you are extending a Qt class). <br>
<br>For qtpaint, I'm working on getting the infrastructure in place for generating Smoke for some of the classes (like Layer), though I think I'll still just directly bind the painting interface, since Painter just derives from QObject, and we do not need those methods.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
>> o Related question: Let's say I want to manipulate a QWidget in<br>
>> native code; e.g.<br>
>><br>
>> In R:<br>
>><br>
>> edit <- Qt$QTextEdit()<br>
>><br>
>> The in C++:<br>
>><br>
>> QTextEdit *editor = getPointer(edit);<br>
>> RSyntaxHighlighter *highlighter =<br>
>> new RSyntaxHighlighter(editor->document());<br>
>><br>
>> unwrapQWidget() doesn't work obviously, as it uses the old model.<br>
>> What would be the equivalent in the new world? If this is<br>
>> available, then we probably get some flexibility in using both the<br>
>> old and new models together, even if we can't easily make new C++<br>
>> classes available in R.<br>
>><br>
>><br>
><br>
> This would be unwrapSmoke().<br>
<br>
</div>This needs to go into qtbase.h to be used from other packages, right?<br>
<br>
BTW, are you getting a crash with<br>
<br>
> library(qtbase)<br>
> Qt$QStringList<br>
<br>
*** caught segfault ***<br>
address (nil), cause 'memory not mapped'<br>
<br>
Traceback:<br>
1: .Call(qt_qmethods, x)<br>
2: qmethods(cl)<br>
3: qsmokeClass(lib, className)<br>
4: function () { class <- qsmokeClass(lib, className) rm(list =<br>
className, envir = lib) assign(className, class, lib)<br>
lockBinding(className, lib) class}()<br>
<font color="#888888"><br>
-Deepayan<br>
</font></blockquote></div><br>