[RQt-devel] Question about Qt$QComboBox in qtbase
John Verzani
verzani at math.csi.cuny.edu
Wed Apr 14 16:41:19 CEST 2010
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.)
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20100414/b7062673/attachment.htm
More information about the Qtinterfaces-devel
mailing list