PDA

View Full Version : how to use enums



soul_rebel
23rd March 2006, 20:40
this might sound a little stupid and i really dont know if this a c++ or kde problem :confused:

i have subclassed KProcess (not that KProcess is not derived from QProcess) and i need to pass two arguments to start().
you can read this up at http://developer.kde.org/documentation/library/3.4-api/kdecore/html/classKProcess.html#a9
now i dont know how to do it.
i thought that enums were just used as "names-for-int-values" and i have always just used the int value instead of bothering with the words but kdevelop tells me it "cannot convert int to KProgress::RunMode". so i tried casting the int, but it doesnt work and KProgress::OwnGroup (which is the 4th element of RunMode enum) is undeclared...
what am i doing wrong?
thanks!

high_flyer
23rd March 2006, 21:02
I don't think I follow - could you show the code you are trying and the corresponding error?
Where are you getting the enums int value from that you pass to the method??
Why can't you just use the correct enum name?

jpn
23rd March 2006, 21:30
KProgress::OwnGroup (which is the 4th element of RunMode enum) is undeclared...
I'm not sure, I've never played around with KProcess, but shouldn't it be KProcess::OwnGroup?

soul_rebel
23rd March 2006, 21:49
shouldn't it be KProcess::OwnGroup?
:o you are right :o
i really need more focus... to many things going on in my head right now...
anyways, problem solved.
thank you