QVector<QPushButton*> btn;
btn.clear();
for(int j=0; j<HOW_MANY_BUTTONS; j++)
{
b->setGeometry(0,0,40,40);
btn << b;
ui->verticalLayout->addWidget(btn[j],Qt::AlignVCenter);
connect(btn[j], SIGNAL(clicked()), sigMap, SLOT(map()));
sigMap->setMapping(btn[j], j);
}
connect(sigMap, SIGNAL(mapped(int)), this, SLOT(func(int)));
QVector<QPushButton*> btn;
btn.clear();
for(int j=0; j<HOW_MANY_BUTTONS; j++)
{
QPushButton *b = new QPushButton;
b->setGeometry(0,0,40,40);
btn << b;
ui->verticalLayout->addWidget(btn[j],Qt::AlignVCenter);
connect(btn[j], SIGNAL(clicked()), sigMap, SLOT(map()));
sigMap->setMapping(btn[j], j);
}
connect(sigMap, SIGNAL(mapped(int)), this, SLOT(func(int)));
To copy to clipboard, switch view to plain text mode
Bookmarks