I am trying to create QLabels's depending on the amount of fields in a give file which will change. The NumFieldsH(hRfmfile) is a c function that that returns the number of fields as an int.

Qt Code:
  1. /* Create the data layout */
  2. dataGroupBox = new QGroupBox;
  3. gridGroupBox->setTitle(tr("Buttons"));
  4. datalayout = new QGridLayout;
  5.  
  6. QLabel field[NumFieldsH(hRfmfile)];
  7. for(i = 0; i < NumFieldsH(hRfmfile); i++){
  8.  
  9. field[i] = new QLabel("test");
  10. datalayout->addWidget(field[i],i,1);
  11. }
  12.  
  13. dataGroupBox->setLayout(datalayout);
To copy to clipboard, switch view to plain text mode 

the header
Qt Code:
  1. public:
  2. QGroupBox *dataGroupBox;
  3. QGridLayout *datalayout;
To copy to clipboard, switch view to plain text mode 
Im getting errors when i compile this for the 2 lines in the loop, what am I doing wrong?