So I want to call function when I press the button that I created like that:
QPushButton *pb = new QPushButton;
Function I want to call is :Engine::gauss(QLineEdit *&line, QLineEdit *&results, int sizeMatters)
. So the problem is I all those arguments are in another slot, in on_button_clicked function to be exact:
void MainWindow::on_pushButton_clicked()
{
Result x;
int sizeMatters;
sizeMatters=ui->le_size->text().toInt();
int c = ui->grid->count();
if(c!=0){
for(int m = 0; m < c; m++){
ui->grid->itemAt(m)->widget()->close();
}
}
c = ui->grid_results->count();
if(c!=0){
for(int f = 0; f < c; f++){
ui->grid_results->itemAt(f)->widget()->close();
}
}
ui->le_size->setMaxLength(2);
QLineEdit *line = new QLineEdit[sizeMatters*sizeMatters];
QLabel *label = new QLabel[sizeMatters];
QLineEdit *results = new QLineEdit[sizeMatters];
QLineEdit *finals = new QLineEdit[sizeMatters];
int w = 0;
for(int j = 0; j<sizeMatters; j++){
for(int i = 0; i<sizeMatters; i++){
ui->grid->addWidget(&line[w],j+1,i+1);
w++;
}
label[j].setText("=");
ui->grid->addWidget(&label[j],j+1,sizeMatters+1);
ui->grid->addWidget(&results[j],j+1,sizeMatters+2);
}
for(int j = 0; j<sizeMatters; j++){
ui->grid_results->addWidget(&finals[j],1,j+1);
}
QPushButton *pb = new QPushButton;
if(c==0){
ui->verticalLayout->addWidget(pb);
}
for(int p=0;p<sizeMatters;p++){
QString liczba = QString::number(x.wyniki[p]);
finals[p].setText(liczba);
}
}
So I want to call gauss function that is in engine.cpp, and is part of Engine class, when clicking "pb" button. How can I achieve that?