Hi
As title says, this is my code
...
QStringList test;
...
QRadioButton *Btn[test.size()];
but it show error "it needs constants"
i don't want to rewrite like this QRadioButton *Btn[100];
please give me some advice
thanks!
Hi
As title says, this is my code
...
QStringList test;
...
QRadioButton *Btn[test.size()];
but it show error "it needs constants"
i don't want to rewrite like this QRadioButton *Btn[100];
please give me some advice
thanks!
When you declare an array on the stack, then the compiler needs to know the size at compile time.
You can either allocate an array on the heap (as that happens during runtime) or do the smart thing and use a container, e.g. QVector.
Cheers,
_
Bookmarks