This code will create line box and a combox when clicked on a "ADD" button, but at the same time i would like to provide "CLEAR "button, which will delete all these creations...how can i able to do that?

Qt Code:
  1. void fileopen::on_pushButton_ADD_clicked()
  2. {
  3.  
  4. static int LayoutCount;
  5.  
  6. QLineEdit *lineEdit = new QLineEdit;
  7.  
  8.  
  9. QLabel *label = new QLabel;
  10. QLabel *label2 =new QLabel;
  11. QComboBox *comboBox =new QComboBox;
  12. comboBox->addItem("COUNT");
  13. label->setText("ENTER SEARCH KEY");
  14. label2->setText("UNDER THE TAG");
  15.  
  16. ui->gridLayout_3->alignment();
  17. ui->gridLayout->addWidget( label,LayoutCount,0 );
  18. ui->gridLayout->addWidget( lineEdit,LayoutCount,1 );
  19. ui->gridLayout->addWidget( label2,LayoutCount,2 );
  20. ui->gridLayout->addWidget(comboBox,LayoutCount,3);
  21.  
  22. lineEditList.append(lineEdit);
  23. TagList.append(comboBox);
  24.  
  25. LayoutCount=LayoutCount+1;
  26.  
  27. }
To copy to clipboard, switch view to plain text mode