Results 1 to 5 of 5

Thread: CloseEvent() not calling destructor

  1. #1
    Join Date
    Jan 2013
    Location
    Bangalore
    Posts
    49
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default CloseEvent() not calling destructor

    hi,
    i have re implemented CloseEvent(), below is the code. the problem is after i close the tool it is still existing in the processes table (task manager -> processes) and i have observed main window destructor is not calling after this. i am not sure what is the problem. please provide some solution.

    Thanks in advance .

    Qt Code:
    1. void mainwindow::closeEvent(QCloseEvent* f_event)
    2. {
    3. if(flag)
    4. {
    5. if(QMessageBox::Yes == QMessageBox::question(this,"Conformation..",
    6. "file is recording...\nDo you want to close the tool...?",QMessageBox::Yes|QMessageBox::No))
    7. {
    8. QMainWindow::closeEvent(f_event);
    9. }
    10. else
    11. {
    12. f_event->ignore();
    13. return;
    14. }
    15. }
    16. QMainWindow::closeEvent(f_event);
    17. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: CloseEvent() not calling destructor

    Is this the only window?

    If so, is "quit on last window closed" set?
    http://qt-project.org/doc/qt-4.8/qap...dowClosed-prop

    Cheers,
    _

  3. #3
    Join Date
    Jan 2013
    Location
    Bangalore
    Posts
    49
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: CloseEvent() not calling destructor

    yes this is the last window, but this flag is not working for me. i have design mainwindow in designer and the seting up that window to mainwindow ( QMainwindow::setupui(ui) ).

    Thanks.
    Durga .

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: CloseEvent() not calling destructor

    Not sure what you mean. The application doesn't care how you created the window.

    So just to be sure: you have verified that the flag is set to true?

    If you check the size of the list from QApplication::topLevelWidget() in your closeEvent() handler, how long is it?

    Does the program exit when you do not overwrite the closeEvent() handler?

    Cheers,
    _

  5. #5
    Join Date
    Jan 2013
    Location
    Bangalore
    Posts
    49
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: CloseEvent() not calling destructor

    hai,
    this is because the flag i have set in my application. my problem got solved. thanks for your reply.

Similar Threads

  1. Calling function in a widget's destructor
    By fiodis in forum Newbie
    Replies: 4
    Last Post: 5th December 2012, 18:54
  2. Replies: 2
    Last Post: 22nd November 2012, 05:03
  3. Can't override the closeEvent()
    By scot_hansen in forum Newbie
    Replies: 7
    Last Post: 5th October 2010, 22:47
  4. closeEvent help needed
    By sgmurphy19 in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2007, 17:51
  5. closeEvent
    By jochen_r in forum Newbie
    Replies: 7
    Last Post: 16th January 2006, 12:05

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.