Hello, I'm developing a project where I will have many calls to new windows and need to recover a value of these windows to the main window (MainWindow). The problem is that it becomes impossible to get the returned value because, when closing the new window, the value is lost with its destructor and does not return to the main window.
EDIT2:
My code for the new window where I return a value (tamveicdialog.cpp):
int TamVeicDialog::getLargura(){
return this->largura;
}
void TamVeicDialog::on_ButtonSalvar_clicked(){
this->close();
}
Call my new window in the main window:
void mainwindow::on_ButtonTamVeic_clicked(){
TamVeicDialog *tamVeic = new TamVeicDialog();
tamVeic->setFixedSize(696, 368);
tamVeic->reset(); // seta alguns valores de atributos da nova janela //
tamVeic->show();
int larg = tamVeic->getLargura();
qDebug() << "Largura retornada: " << larg;
}
The idea is to click save in the TamVeic window, it returns the width value for MainWindow. Would anyone know how to return this value to my Mainwindow? Thank you in advance.
Note: Although my window has a dialog in its declaration, it is QWidget type, I think this question may have caused problems to understand my problem.