Results 1 to 2 of 2

Thread: main.cpp performing action after mainwindow.cpp close

  1. #1
    Join Date
    Feb 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default main.cpp performing action after mainwindow.cpp close

    I have the main and mainwindows cpp, yes, i need to have both.
    How do i do to main.cpp performing a action only after mainwindow.cpp is closed?

    I have tried
    ConfigCamera c;
    c.show();
    c.CameraQuantidade(CAMERAS);
    c.close();
    std::cout <<"i'm here" <<std::endl;

    and
    ConfigCamera c;
    c.show();
    c.CameraQuantidade(CAMERAS);
    while(!c.isClosed) {
    }
    std::cout <<"i'm here" <<std::endl;

    but they haven't work.

    How should i do this?

  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: main.cpp performing action after mainwindow.cpp close

    You could emit a signal from widget's closeEvent() handler and connect a slot to that.

    Or, if it is a dialog, run it with exec() and put your code after it returns.

    Or, if this is the main window, put your code after exec() of the QApplication has returned.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 13th November 2015, 20:42
  2. Replies: 2
    Last Post: 28th September 2012, 17:15
  3. QT application not close after close the mainwindow
    By artome in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2011, 22:23
  4. Replies: 4
    Last Post: 1st June 2011, 14:54
  5. Quit action in MainWindow
    By Backslash in forum Newbie
    Replies: 9
    Last Post: 31st July 2007, 21:21

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.