run function before closing QMainWindow
Hi everybody..
QT: 4.1.3
I would like to run a function before i close my window (QMainWindow) like this and it is not working.
Can somebody see why?
Code:
MainWindow::MainWindow()
{
ui.setupUi(this);
.
.
.
connect(this, SIGNAL(close()), this, SLOT(deletePicture()));
Re: run function before closing QMainWindow
Neither QMainWindow or QWidget offers a signal called close(). I take it that you haven't declared a custom signal either, since it most probably would cause compilation problems because there already is a slot called QWidget::close().
Override QWidget::closeEvent() and do your task there.