我在将 QPushButton 添加到 ui 时遇到问题。我这样做:
QPushButton *mine[PlayForm->horizontal][PlayForm->vertical];
for(int i=0; i<PlayForm->horizontal; i++)
{
for(int j=0; j<PlayForm->vertical; j++)
{
QWidget wdg;
mine[i][j] = new QPushButton(" ", &wdg);
mine[i][j]->setGeometry(size*i, size*j, size, size);
mine[i][j]->show();
PlayForm->layout()->addWidget(mine[i][j]);
}
}
所以我该怎么做?!