I am trying to create an array of pointers to MainWindow functions, because I need to loop and execute all of the functions associated with my pushbuttons and spinboxes automatically. Here is the sample code:
typedef void (*f_pointer)();
void MainWindow::on_test_spinBox_valueChanged(int a){
ui->label->setNum(a);
}
void MainWindow::on_test_pushButton_clicked() {
int a = 1 + 2;
}
void MainWindow::on_test2_pushButton_clicked() {
int a = 2 + 3;
}
void MainWindow::on_run_all_pushButton_clicked() {
f_pointer array[] = { MainWindow::on_test_spinBox_valueChanged(), MainWindow::on_test2_pushButton_clicked(), MainWindow::on_test_pushButton_clicked() };
for (int i = 0; i < 2; i++)
array[i];
}
All of this results in error: void value not ignored as it ought to be.
Can you help? Thanks.