c ++ - How to pass parameters between windows in Qt? [closed]

0

Hello, I'm trying to pass a Mat parameter from one window to another, being activated by the click of a button. The program normally compiles and executes, but when clicking the button that activates the event, the program of a chrash in the execution. Here is the code that calls the other window:

void MainWindow::on_commandLinkButton_clicked(){

    Form *form = new Form();
    form->setInput(this->ModFirstP);
    form->execTransform();
    form->setLabels();
    form->show();

}

The problem parameter is the ModFirstP of type Mat, I want to set it in an attribute of the other window I am generating:

.H

void setInput(Mat&);

.cpp

void Form::setInput(Mat& in){
    this->input = in;
}

Would anyone know how to pass parameters between Windows (Forms) in Qt? Or does Qt only accept QObject objects as parameters between windows? Thank you in advance.

    
asked by anonymous 28.08.2016 / 00:54

1 answer

1

Well, after hours and hours breaking my head about what would be causing the crash of the application, I discovered that the problem was with the line setupi- (this); where I had accidentally deleted the constructor from my new window class. After including this line, the code worked normally, and the problem was not in the passage of parameters as I had imagined. It seems to me that this line that I deleted triggers any kind of interaction and manipulation with my class from my second window, so the program would compile normally but could not access the class data. Well, anyway, thanks for the answers and attention.

    
28.08.2016 / 05:30