PDA

View Full Version : run function before closing QMainWindow



raphaelf
31st August 2006, 09:14
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?



MainWindow::MainWindow()
{
ui.setupUi(this);
.
.
.
connect(this, SIGNAL(close()), this, SLOT(deletePicture()));

jpn
31st August 2006, 09:21
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.