I am trying to disable button previously chosen by user
void pracownik2::on_pushButton_4_clicked(){
this->setWindowTitle("EKRAN");
QWidget *centralWidget = new QWidget;
int licznik=1;
QString licz;
//QString kolumny = ui->lineEdit->text();
//QString wiersze = ui->lineEdit_2->text();
miejsca2 = ui->lineEdit_3->text().toInt();
//QPushButton *button[wiersze.toInt()][kolumny.toInt()];
QPushButton *button[3][6];
QGridLayout *controlsLayout = new QGridLayout;
for(int i=0;i<3;i++)
{
for(int j=0;j<6;j++)
{
licz = QString::number(licznik);
licznik++;
button[i][j] = new QPushButton(licz);
button[i][j]->setCheckable(1);
if(tab[i][j]==1)
button[i][j]->setEnabled(false);
controlsLayout->addWidget(button[i][j], i, j);
}
}
QPushButton *okej = new QPushButton("Zatwierdź");
QPushButton *anul = new QPushButton("Anuluj");
controlsLayout->addWidget(okej, 3, 0);
controlsLayout->addWidget(anul, 3, 1);
controlsLayout->setHorizontalSpacing(0);
controlsLayout->setVerticalSpacing(0);
centralWidget->setLayout(controlsLayout);
setCentralWidget(centralWidget);
for(int i=0;i<3;i++)
{
for(int j=0;j<6;j++)
{
connect(button[i][j],SIGNAL(toggled(bool)),this,SLOT(tescik(bool)));
}
}
connect(anul,SIGNAL(clicked()),this,SLOT(close()));
connect(okej,SIGNAL(clicked()),this,SLOT(okay2()));}
void pracownik2::tescik(bool t){
if (t)
{
tab[i][j]=1;
miejsca++;
}
else
{
tab[i][j]=0;
miejsca--;
}}
but my 'tescik' function doesn't know what 'i' and 'j' are and the project won't compile, my question is how to make checked button set value 1 in the array and unchecked restore it to 0. I guess I have to edit 'connect' line but I have no idea how
@EDIT I am trying to make this line
connect(button[i][j],SIGNAL(toggled(bool)),this,SLOT(tescik(bool,int i,int j)));
pass 'i' and 'j' of current button to function but it doesn't work