Hi, this is our first time creating a GUI as we have previously only used console applications. We have a lot of push buttons(81), and would like to read the text from any one of them, when any one is clicked. We know how to read the text using the text() function, but can't find a way without copying and pasting the syntax 81 times for each button.
1 2 3 4 5 6 7 8 9 10 11 12
void hardAI::on_button_1_clicked()
{
QString buttonText;
buttonText=ui->button_1->text();//get text from button1
}
void hardAI::on_button_2_clicked()
{
QString buttonText;
buttonText=ui->button_2->text();//get text from button2
}
//etc