I'm guessing:
field
[i
] = new QLabel("test");
field[i] = new QLabel("test");
To copy to clipboard, switch view to plain text mode
: cannot convert 'QLabel *' to 'QLabel' in assignment
datalayout->addWidget(field[i],i,1);
datalayout->addWidget(field[i],i,1);
To copy to clipboard, switch view to plain text mode
: no matching function to call to QGridLayout::addWidget(QLabel,int,int), candidates are QGridLayout::addWidget(QWidget*,int,int)
or something like that 
btw. I'm not commenting on solution, because Santosh code should work 
----
edit2:
You are declaring a array of (...) on stack, when doing so, you need to give a constant value as size.
Depends on the compiler. For example in g++ 4.5.x following code is perfectly valid:
#include <iostream>
#include <stdlib.h>
int main( int argc, char ** argv ){
if( argc > 1 ){
int x[ atoi(argv[1]) ];
std::cout << sizeof(x)/sizeof(int); // should print a value given in program argument
}
return 0;
}
#include <iostream>
#include <stdlib.h>
int main( int argc, char ** argv ){
if( argc > 1 ){
int x[ atoi(argv[1]) ];
std::cout << sizeof(x)/sizeof(int); // should print a value given in program argument
}
return 0;
}
To copy to clipboard, switch view to plain text mode
This feature is called variable-length arrays (VLA), and is part of C99 standard supported by gcc.
Bookmarks