Results 1 to 2 of 2

Thread: QT application not close after close the mainwindow

  1. #1
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QT application not close after close the mainwindow

    Hi,

    I have an application that stays in memory even after closing the mainwindow.
    I think that this behavior is recent so I really don't know if this has something to do with recent QT updates.

    My application is an mdi aplication were the main window has a mdiarea and a treeview.
    looking for this problem on the net I really improved the way I was closing the main window by using
    eventclosed and close all the mdi childs before left. I even try to use a.setQuitOnLastWindowClosed(true); thatr shoud be the default. Burt the result is the same.

    my system is opensuse14.4 and QT 4.7.3-186.1-X86_64

    any help would be appreciated.

    I join may main.cpp where cloud class is the mainwindow class.




    #ifdef WIN32
    #include <winsock2.h>
    #include <windows.h>
    #endif


    #include <QtGui/QApplication>
    #include <QCleanlooksStyle> //para comentar se quisermos deixar o default do sistema
    #include "cloud.h"


    int main(int argc, char *argv[])
    {
    setlocale(LC_ALL, "C");
    QApplication a(argc, argv);
    // a.setQuitOnLastWindowClosed(true);
    a.setStyle("Cleanlooks"); //para comentar se quisermos deixar o default do sistema
    // a.setQuitOnLastWindowClosed(false);


    Cloud w;

    w.show();

    return(a.exec());


    Added after 1 15 minutes:


    more information on this problem
    I just add the line
    w.setAttribute(Qt::WA_DeleteOnClose);
    before
    w.show();

    And now the program crashes on close.
    only starting the program and closing the main windows without performing any task
    I get the signal when trying to debug in qtcreator

    The inferior stopped because it received a signal from the Operating System.

    Signal name :
    SIGABRT
    Signal meaning :
    Aborted
    because I did nothing other than start and close the program all the calls shown of in the debuger are calls to system it crashes in raise function in /lib64/libc.so.6
    Last edited by artome; 22nd July 2011 at 21:09.

  2. #2
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QT application not close after close the mainwindow

    adding the line
    w.setAttribute(Qt::WA_QuitOnClose);
    seemed to have solved the problem.

Similar Threads

  1. Replies: 2
    Last Post: 17th December 2010, 20:01
  2. There Signal Close or Show in MainWindow??
    By macgayver in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2010, 06:35
  3. how to close application
    By mohanakrishnan in forum Newbie
    Replies: 23
    Last Post: 10th November 2009, 11:33
  4. Replies: 3
    Last Post: 23rd July 2006, 19:02
  5. Replies: 1
    Last Post: 1st June 2006, 13:46

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.