Hey, I have a 10x10 field of pushButtons and I have a Code for what happens, when one is clicked. How can I rewrite the Code, so that the Code applies for every pushButton and I dont have to rewrite my Code for every one of them? With my Code I would have to create 100 variable and have to Change every one in the Code for each pushButton plus I would rewrite the Name of the pushButton in every one. I would like to have a Code which I can copy and paste in every pushButton. I searched a lot but with my Knowledge a lot is hard to understand. Maybe you have any idea?
My Code so far is:

int i=1;

void MainWindow:n_pushButton_clicked()
{
if((i==1))
{
ui->pushButton->setStyleSheet("QPushButton { background-color: grey; }\n"
"QPushButton:enabled { background-color: rgb(200,0,0,100); }\n");
i=i+1;

}
else
{
if((i==2))
{
ui->pushButton->setStyleSheet("QPushButton { background-color: grey; }\n"
"QPushButton:enabled { background-color: rgb(0,200,0,100); }\n");
i=i+1;
}
else
{
ui->pushButton-> setStyleSheet("QPushButton { }\n"
"QPushButton:enabled { }\n");
i=i-2;
}
}

}