<br><br><div class="gmail_quote">On Thu, Nov 19, 2009 at 4:15 AM, Deepayan Sarkar <span dir="ltr"><<a href="mailto:deepayan.sarkar@gmail.com" target="_blank">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;">
On Wed, Nov 18, 2009 at 2:49 PM, Deepayan Sarkar<br>
<div><<a href="mailto:deepayan.sarkar@gmail.com" target="_blank">deepayan.sarkar@gmail.com</a>> wrote:<br>
> On Wed, Nov 18, 2009 at 1:46 PM, Deepayan Sarkar<br>
> <<a href="mailto:deepayan.sarkar@gmail.com" target="_blank">deepayan.sarkar@gmail.com</a>> wrote:<br>
>> Any idea what's going wrong here?<br>
>><br>
>> ### Just code:<br>
>><br>
>> library(qtbase)<br>
>><br>
>> gscene <- Qt$QGraphicsScene()<br>
>> rtxt <- gscene$addText("some text")<br>
>> rtxt<br>
>> (rtxt$toPlainText()) ## fine<br>
><br>
> And as a confirmation that the <QList> thing is not a problem, I get:<br>
><br>
>> item0 <- gscene$itemAt(0, 0)<br>
>> item0<br>
> <environment: 0x9e21428><br>
> attr(,"class")<br>
> [1] "QGraphicsTextItem" "QObject" "QGraphicsItem"<br>
> [4] "UserDefinedDatabase" "environment"<br>
>> item0$toPlainText()<br>
><br>
> *** caught segfault ***<br>
<br>
</div>Other QGraphicsItem-s seem fine, so it must be the multiple<br>
inheritance (QObject+QGraphicsItem) problem of QGraphicsTextItem<br>
again. Given that rtxt works but item0 doesn't, maybe it's a coercion<br>
problem somewhere in the wrapping stage?<br>
<font color="#888888"><br></font></blockquote><div><br>Everything method invocation fails with item0. The weird thing is that the environments are different. Every C++ pointer should have the same environment, and this holds true for the other QGraphicsItem types. This indicates that the pointer being returned by itemAt() and items() is incorrect.<br>
<br>Just checked it, and it looks like the pointer retrieved by e.g. itemAt() points 8 bytes higher than the one from addText(). This happens at the Smoke level, but looking at their wrappers reveals nothing. Yes, they are casting to different types, (QGraphicsTextItem *) vs (QGraphicsItem *), but that shouldn't change the value of the pointer, should it? The same error happens for addWidget() and its QGraphicsProxyWidget return value. So yes it seems like a multiple inheritance issue, but I don't understand how a simple cast could cause this. Maybe it's just another C++ surprise?<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;"><font color="#888888">
-Deepayan<br>
</font><div><div></div><div>_______________________________________________<br>
Qtinterfaces-devel mailing list<br>
<a href="mailto:Qtinterfaces-devel@lists.r-forge.r-project.org" target="_blank">Qtinterfaces-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel</a><br>
</div></div></blockquote></div><br>