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.
/* Create the data layout */
gridGroupBox->setTitle(tr("Buttons"));
QLabel field
[NumFieldsH
(hRfmfile
)];
for(i = 0; i < NumFieldsH(hRfmfile); i++){
field
[i
] = new QLabel("test");
datalayout->addWidget(field[i],i,1);
}
dataGroupBox->setLayout(datalayout);
/* Create the data layout */
dataGroupBox = new QGroupBox;
gridGroupBox->setTitle(tr("Buttons"));
datalayout = new QGridLayout;
QLabel field[NumFieldsH(hRfmfile)];
for(i = 0; i < NumFieldsH(hRfmfile); i++){
field[i] = new QLabel("test");
datalayout->addWidget(field[i],i,1);
}
dataGroupBox->setLayout(datalayout);
To copy to clipboard, switch view to plain text mode
the header
public:
public:
QGroupBox *dataGroupBox;
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?
Bookmarks