I'm trying to display a QMessageBox through calling its show function in a lambda function like the following:
connect(ui->graphButton, &QAbstractButton::clicked, [](void){
QMessageBox message;
message.setText(tr("Graphing button clicked"));
message.show();
});
However, upon clicking the graphButton, the QMessageBox window appears only momentarily before disappearing. How can I fix this?