Hello!

I've got a problem with buttons and pointers. I need to create dynamically something like "array" of buttons on one of my application windows (each time the window opens). Now I've got some code:

Qt Code:
  1. QPushButton *btn[HOW_MANY_BUTTONS];
  2.  
  3. for(int j=0; j<HOW_MANY_BUTTONS; j++)
  4. {
  5. btn[j] = new QPushButton;
  6. btn[j]->setGeometry(0,0,40,40);
  7.  
  8. ui->verticalLayout->addWidget(btn[j],Qt::AlignVCenter);
  9. }
To copy to clipboard, switch view to plain text mode 

It works just fine. But number of buttons is changing, and I don't want to create array of pointers which is bigger or smaller than number of buttons. Any suggestions how should I write function which is creating as many buttons as I need in a moment?

thanks in advance
best regards
Tomasz