I want to create many buttons in Qt within a loop.
In header file:
QVector<QPushButton> *btns;
In cpp file:
btns = new QVector<QPushButton>();
for(int i = 0; i <= 10; i++) {
btns->append(new QPushButton(QString::number(i),this));
}
I'm getting the error:
cannot convert argument 1 from 'QPushButton *' to 'const QPushButton &'
It's probably not hard to fix it, but I am not too good with pointers. Can you help me?
Aucun commentaire:
Enregistrer un commentaire