The problem is that you declare a local object in the function's scope:
Qt Code:
void DialogForm::on_pbClearLineEdit_clicked() { MainWindow m; // <-- this is allocated on the stack and will be deleted at the end of the scope m.clear(); // }To copy to clipboard, switch view to plain text mode
You should use a signal from the dialog class to inform the MainWindow that the "clear" button was pressed. Declare a signal in your Dialog class and connect it to `MainWindow::clear` slot.
Bookmarks