Hi, I am a new user of the forum and a beginner programmer in Qt.
I have 2 problems.
First:
I have a QGridLayout in which I insert my custom widget. When I add a new widget to the list I must refresh it. So how can I delete all widget conteined in QGridLayout?

I have tried with the following code:

Qt Code:
  1. while(grid->layout()->count() > 0) {
  2. grid->layout()->removeWidget(grid->layout()->itemId(0)->widget());
  3. }
To copy to clipboard, switch view to plain text mode 

but really the widgets aren't removed. How can I solve?

Second:
I must do a grid in n rows x m cols in which cells I must add my custom widget. I have to add them from top-left, filling before the entire first row, then the second and so on...how can I do?
Now I have done as before, but the widgets are placed in column.


Thanks a lot