Hello,

I have a problem to create a dynamic number of QLabel and QLineEdit.

I have build a QList:

Qt Code:
  1. QList<QLineEdit*> dongleDataLineEdit;
  2. QList<QLabel*> dongleDataLabel;
To copy to clipboard, switch view to plain text mode 

Now, the code to generate my QLabel an QLineEdit.

Qt Code:
  1. void CMainWindow::setDongleDataField() {
  2. for (int i=0; i<plainDongle->DNG_Memmory/4; i++) {
  3. dongleDataLabel.append(new QLabel);
  4. dongleDataLineEdit.append(new QLineEdit);
  5. }
  6.  
  7. displayDongleData();
  8. }
  9.  
  10. void CMainWindow::displayDongleData() {
  11. QGridLayout *dongleLayout = new QGridLayout;
  12. int x = 0;
  13.  
  14. for (int i; i<plainDongle->DNG_Memmory/4; i++) {
  15. dongleDataLabel[i]->setText(tr("Value "+i));
  16. dongleLayout->addWidget(dongleDataLabel[i], x, 0);
  17. dongleLayout->addWidget(dongleDataLineEdit[i], x, 1);
  18. x++;
  19. }
  20. }
To copy to clipboard, switch view to plain text mode 

The problem is, my program does not start, it terminated without any error.

Can someone help me to fix the problem?