Results 1 to 2 of 2

Thread: run function before closing QMainWindow

  1. #1
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default 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?

    Qt Code:
    1. MainWindow::MainWindow()
    2. {
    3. ui.setupUi(this);
    4. .
    5. .
    6. .
    7. connect(this, SIGNAL(close()), this, SLOT(deletePicture()));
    To copy to clipboard, switch view to plain text mode 
    Think DigitalGasoline

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default 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.
    J-P Nurmi

Similar Threads

  1. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  2. Qt 4.1.4 plugin QPSQL
    By jcr in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd June 2006, 22:55
  3. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 08:52
  4. Qt 4.1 and KDE 3.5.1 on OSX 10.2.8
    By Ptero-4 in forum Installation and Deployment
    Replies: 6
    Last Post: 6th February 2006, 02:44
  5. Replies: 25
    Last Post: 15th January 2006, 00:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.