[RQt-devel] Question about Qt$QComboBox in qtbase

Michael Lawrence lawrence.michael at gene.com
Wed Apr 14 19:11:24 CEST 2010


Alright, I think it's fixed in svn. Was deleting the QStandardItem, even
though Qt owned it (in the model). Unfortunately, Qt has fairly ad-hoc
memory ownership policies compared to GTK+.

Also, in this simple case, you might find cb$insertItem(i-1, letters[i]) to
be easier than explicitly creating the QStandardItem.

At some point we will need vectorized functions for populating data models
like rGtkDataFrame.

Michael

On Wed, Apr 14, 2010 at 9:48 AM, Michael Lawrence <michafla at gene.com> wrote:

>
>
> On Wed, Apr 14, 2010 at 7:41 AM, John Verzani <verzani at math.csi.cuny.edu>wrote:
>
>> I am having trouble consistently getting a combobox to behave properly. In
>> particular, with this test case I rarely get past 40 before the process
>> dies. Am I setting up the combobox completely wrong? (I've tried  using
>> setItemText but that failed as well and I don't think my issue is having so
>> many widgets open.)
>>
>>
>> library(qtbase)
>>
>> testit <- function(i) {
>>   cb <- Qt$QComboBox()
>>   mod <- cb$model()
>>
>>   ## set values
>>   sapply(seq_along(letters), function(i) {
>>     item <- Qt$QStandardItem(letters[i])
>>     mod$setItem(i-1, item)
>>   })
>>
>>   cb$setCurrentIndex(2)
>>   cat(i, cb$model()$item(2)$text(), "\n")
>> }
>>
>>
>> ##
>> for(i in 1:1000) {
>>   out <- try(testit(i), silent=TRUE)
>>   if(inherits(out, "try-error")) {
>>     print(i)
>>     stop(i)
>>   }
>> }
>>
>> ## eventually dies but not consistently, e.g:
>> ...
>> 8 c
>> [1] 9
>> Error in eval.with.vis(expr, envir, enclos) :
>>   Error in cat(i, cb$model()$item(2)$text(), "\n") :
>>   attempt to apply non-function
>>
>> (Basically what happens is all items in the model are set to NULL, so the
>> call to the text method fails.)
>>
>>
> Yea it looks like corruption somewhere. No idea where though, will have to
> look into it.
>
> Thanks,
> Michael
>
>
>>
>> > sessionInfo()
>> R version 2.10.1 (2009-12-14)
>> i486-pc-linux-gnu
>>
>> locale:
>> [1] en_US.UTF-8
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] qtbase_0.6-2
>>
>> --
>> John Verzani
>> Chair, Department of Mathematics
>> College of Staten Island, CUNY
>> verzani at math.csi.cuny.edu
>>
>> _______________________________________________
>> 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/20100414/c27fe51f/attachment.htm 


More information about the Qtinterfaces-devel mailing list