In my class, I want a member with type QList<QList<QByteArray> > as a property, should the Q_PROPERTY call be:
Q_PROPERTY(QList myData READ myData)
or
typedef QList<QList<QByteArray> > TYPE_LLB;
Q_PROPERTY(TYPE_LLB myData READ myData)
?
Actually I'm trying QWizard and QWizardPageclasses, data with typeQList<QList<QByteArray> > need to be propagated among pages, Qt manual says registerField and field methods help, but these two methods need widget properties to be defined correctly.
Please help. Thanks!
Related
I'm switching over to using the Auto-IVC component as opposed to the IndepVar component. I'd like to be able to get a list of the promoted output names of the Auto-IVC component, so I can then use them to go and pull the appropriate value out of a configuration file and set the values that way. This will get rid of some boilerplate.
p.model._auto_ivc.list_outputs()
returns an empty list. It seems that p.model__dict__ has this information encoded in it, but I don't know exactly what is going on there so I am wondering if there is an easier way to do it.
To avoid confusion from future readers, I assume you meant that you wanted the promoted input names for the variables connected to the auto_ivc outputs.
We don't have a built-in function to do this, but you could do it with a bit of code like this:
seen = set()
for n in p.model._inputs:
src = p.model.get_source(n)
if src.startswith('_auto_ivc.') and src not in seen:
print(src, p.model._var_allprocs_abs2prom['input'][n])
seen.add(src)
assuming 'p' is the name of your Problem instance.
The code above just prints each auto_ivc output name followed by the promoted input it's connected to.
Here's an example of the output when run on one of our simple test cases:
_auto_ivc.v0 par.x
I have written the following part of a code that adds two numbers together and outputs the result:
QIntValidator *validator = new QIntValidator(0,50,this);
ui->firstNumber->setValidator(validator);
...
...
In this case, I get the following error:
CS2039: 'setValidator': is not a member of QTextEditor
How can I fix this problem?
Use a text input class that supports validation. You probably want QLineEdit
I have just started working with rJava to utilise a host of Java code in an R based application. I've tried some simple "Hello world" type things so I know the basic setup is working. I have several issues however I am hoping they will be resolved if I can resolve this basic problem using .jcall.
> cal = new(J("java/util/GregorianCalendar"))
> obj = new(J("au.gov.ips.dataarchive.TIndex"))
> obj$monthlyT(cal)
[1] 77
> .jcall(obj,"I","monthlyT",cal)
Error in .jcall(obj, "I", "monthlyT", cal) :
method monthlyT with signature (Ljava/util/GregorianCalendar;)I not found
To my understanding, the 3rd and 4th lines are equivalent and should produce the same result. Clearly I am doing something wrong. The 'monthlyT' method is defined in the java code as:
static public Integer monthlyT(Calendar month)
I am not a Java expert, so please let me know what other info about the Java objects I might need to provide to answer the question.
cal is a java.util.GregorianCalendar and not a java.util.Calendar. If you want to use the low-level .jcall interface (why?) then you need to do the casting yourself. So something like this:
.jcall(obj,"I","monthlyT",.jcast(cal, "java/util/Calendar" ))
In a webcrawler/webscraper-setting, I'd like to dynamically extend my base Reference Class URL in order to be able to write specific methods for respective hosts/domains. Just to be clear, by dynamically I mean something like "automatically generate class definitions as new domains are encountered (e.g. class URL_something.com which would inherit from class URL)".
Works a treat, the only problem is that my class WebPage expects the value of field url to be of class URL. It will accept objects of class URL_something.com as this inherits from class URL, but then actually turns the object into an instance of class URL. So I lose the information that it's actually of class URL_something.com.
Do you have any idea of how I can prevent losing that crucial information?
Code Example
setRefClass(Class="URL", fields=list(x="character"))
setRefClass(Class="WebPage", fields=list(url="URL"))
obj <- new("WebPage", url=new("URL", x="http://www.something.com/home/index.html"))
obj$url
# Method would recognize that there is no class 'URL_something.com'
# yet and thus create it:
setRefClass(Class="URL_something.com", contains="URL")
# Another method would take care of mapping field values to
# an instance of the new class:
> url.obj <- new("URL_something.com", x="http://www.something.com/home/index.html")
> inherits(url.obj, "URL")
[1] TRUE
> obj$url <- url.obj
> class(obj$url)
[1] "URL"
# So I lose the information that it was actually of class "URL_something.com"
Picking up on what Martin said (see comments above): R 2.14.0 fixes what I described above.
I need to create an object of type ShortReadQ from Bioconductor's ShortRead library.
ShortReadQ 'signature(sread = "DNAStringSet", quality =
"QualityScore", id = "BStringSet")'
The quality slot needs to be an object inheriting from QualityScore, of which I can easily determine from another ShortReadQ object that I wish to emulate.
> class(quality(anotherObject))
[1] "SFastqQuality"
attr(,"package")
[1] "ShortRead"
What is the best way to use that information ("SFastqQuality") in the contructor argument?
newObject<-ShortReadQ(sread=...,
quality=SFastqQuality(...),
id=...)
Does this do what you want?
quality = new(class(old.quality.obj)[[1]]))
You might want the get function:
a <- get(class(object))
a(...)
thanks for your responses. they lead me to a solution that works
newObject<-ShortReadQ(sread=...,
quality=new(Class=class(quality(anotherObject)),theFirstParameter=...),
id=...)