Tag: The control function shows the deletion of his by code
"Background notes" the name of my main form is called MainWindow, whose subwindow is a class called Subdialog. What I want to do now is call the parent window in the function of the child window.
Open a child window in the parent window
// Popup dialog box to determine the parameters of the transformation new Subdialog (this); // This place is very important . Dialog->setmodal (true); Dialog->show ();
In the above code, the parent window's pointer is passed to the child window through this, so you can use this passed pointer in a child window to control the parent window to do something.
Actions in the child window:
MainWindow *ptr = (mainwindow*) parentwidget (); // This is a very important sentence to get a pointer to the parent form to use Ptr->test (); // has successfully moved to the test function of the main dialog. // Show parent Form Delete This // Delete itself
"QT" controls the parent form in the subform