[RQt-devel] next steps

Michael Lawrence lawremi at gmail.com
Fri Nov 13 22:04:00 CET 2009


On Fri, Nov 13, 2009 at 11:17 AM, Deepayan Sarkar <deepayan.sarkar at gmail.com
> wrote:

> On Fri, Nov 13, 2009 at 6:15 AM, Michael Lawrence <lawremi at gmail.com>
> wrote:
> >
> >
> > On Fri, Nov 13, 2009 at 5:56 AM, Deepayan Sarkar <
> deepayan.sarkar at gmail.com>
> > wrote:
> >>
> >> Hi (Michael, mostly),
> >>
> >> I'm at the stage where I'm happy with updates to qtutils, which is
> >> basically all R code, using signals etc.
> >>
> >> My next target is qtdevices, i.e., a traditional R graphics device
> >> using QGraphicsScene. Is this feasible at this point? I've checked in
> >> a few relevant questions in qtbase/questions.txt, the first couple of
> >> which would help me plan my next steps:
> >>
> >>
> >>  o Can we use user-written classes (defined in C++) from R yet? e.g.,
> >>   RSyntaxHighlighter
> >>
> >
> > Yes, this is possible. Check out, for example, the class wizard demo.
>
> So you're saying that it should be possible to translate a C++ class
> to R, right?
>
>
Most likely, yes.


> It would also be useful to have an existing C++ class wrapped
> directly, as with the Qt classes. How much work is involved in having
> that set up? This must be a common enough problem.
>
>
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).

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.


> >>  o Related question: Let's say I want to manipulate a QWidget in
> >>   native code; e.g.
> >>
> >>   In R:
> >>
> >>      edit <- Qt$QTextEdit()
> >>
> >>   The in C++:
> >>
> >>      QTextEdit *editor = getPointer(edit);
> >>      RSyntaxHighlighter *highlighter =
> >>          new RSyntaxHighlighter(editor->document());
> >>
> >>   unwrapQWidget() doesn't work obviously, as it uses the old model.
> >>   What would be the equivalent in the new world?  If this is
> >>   available, then we probably get some flexibility in using both the
> >>   old and new models together, even if we can't easily make new C++
> >>   classes available in R.
> >>
> >>
> >
> > This would be unwrapSmoke().
>
> This needs to go into qtbase.h to be used from other packages, right?
>
> BTW, are you getting a crash with
>
> > library(qtbase)
> > Qt$QStringList
>
>  *** caught segfault ***
> address (nil), cause 'memory not mapped'
>
> Traceback:
>  1: .Call(qt_qmethods, x)
>  2: qmethods(cl)
>  3: qsmokeClass(lib, className)
>  4: function () {    class <- qsmokeClass(lib, className)    rm(list =
> className, envir = lib)    assign(className, class, lib)
> lockBinding(className, lib)    class}()
>
> -Deepayan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20091113/b4cc8080/attachment.htm 


More information about the Qtinterfaces-devel mailing list