[RQt-devel] Layers and layout

Michael Lawrence lawrence.michael at gene.com
Tue Sep 21 15:33:29 CEST 2010


On Tue, Sep 21, 2010 at 4:14 AM, Deepayan Sarkar
<deepayan.sarkar at gmail.com>wrote:

> Hi,
>
> In my efforts to resurrect mosaiq, I have managed to put two "panel"
> layers on the root layer as follows:
>
> -----------
>
> library(qtpaint)
>
> scene <- qscene()
> root <- qlayer(scene)
>
> scatterplotLayer <-
>    function(x = runif(10), y = runif(10),
>             fill = "black", row, col)
> {
>    force(x)
>    force(y)
>    paintFun <- function(item, painter, exposed)
>    {
>        qdrawGlyph(painter, qglyphCircle(), x, y, fill = qcolor(fill))
>    }
>    qlayer(root, paintFun = paintFun, cache = TRUE,
>           limits = qrect(c(0, 1), c(0, 1)),
>           row = row, col = col)
> }
>
> panel1 <- scatterplotLayer(row = 0, col = 0, fill = "red")
> panel2 <- scatterplotLayer(row = 1, col = 1, fill = "green")
>
> (view <- qplotView(scene = scene, opengl = FALSE))
>
> -----------
>
> However, this requires that I specify the position in the layout at
> the time of creating the layer. The old mosaiq created parent-less
> layers first and then put them in the root layer's layout. I have
> tried this in two ways, both have failed:
>
> -----------
>
> library(qtpaint)
> scene <- qscene()
> root <- qlayer(scene)
>
> scatterplotLayer <- function(x = runif(10), y = runif(10), fill = "black")
> {
>    force(x)
>    force(y)
>    paintFun <- function(item, painter, exposed)
>    {
>        qdrawGlyph(painter, qglyphCircle(), x, y, fill = qcolor(fill))
>    }
>    qlayer(NULL, paintFun = paintFun, cache = TRUE,
>           limits = qrect(c(0, 1), c(0, 1)))
> }
>
> panel1 <- scatterplotLayer()
> panel2 <- scatterplotLayer()
>
> ## This gives an error: Wrong number or types of arguments passed to
> ## 'Qanviz::RLayer::addLayer'
> root[0, 0] <- panel1
> root[1, 1] <- panel2
>
>
This issue is now fixed in qtpaint svn (0.7.11).


> ## This crashes
> layout <- root$gridLayout()
> layout$addItem(panel1, 0, 0)
> layout$addItem(panel2, 1, 1)
>
>
This crash is due to a bug in Smoke. The Smoke guy said he would fix it some
weekend.


> -----------
>
> Is there a way to achieve this? How is addLayer supposed to work?
>
> -Deepayan
> _______________________________________________
> Qtinterfaces-devel mailing list
> Qtinterfaces-devel at lists.r-forge.r-project.org
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20100921/202e3e4f/attachment.htm>


More information about the Qtinterfaces-devel mailing list