Results 1 to 2 of 2

Thread: Gui hangs when close button is clicked

  1. #1
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Gui hangs when close button is clicked

    Hello,
    I am a newbie in Qt.I would like to close a window but the Qt Gui hangs when I do so.
    I am trying to close the Gui with this->close()

    Qt Code:
    1. connect(ui->Close, SIGNAL(clicked()), this, SLOT(close()));
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void MainWindow::close()
    2. {
    3. this->close();
    4. }
    To copy to clipboard, switch view to plain text mode 

    Can anybody tell me how to close the Gui without hanging it.

  2. #2
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Gui hangs when close button is clicked

    Qt Code:
    1. #include <QApplication>
    2.  
    3. connect(ui->Close, SIGNAL(clicked()), qApp, SLOT(quit()));
    4.  
    5. or
    6.  
    7. connect(ui->Close, SIGNAL(clicked()), qApp, SLOT(closeAllWindows()));
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. How can find which button is clicked.
    By Niamita in forum Qt Programming
    Replies: 5
    Last Post: 27th June 2011, 14:35
  2. Replies: 2
    Last Post: 6th May 2011, 08:02
  3. How to get the clicked button handle?
    By Gokulnathvc in forum Newbie
    Replies: 1
    Last Post: 27th April 2011, 08:06
  4. Replies: 2
    Last Post: 26th April 2011, 11:44
  5. QMenu popup: how close when clicked outside
    By powermax in forum Qt Programming
    Replies: 5
    Last Post: 4th March 2009, 03:18

Tags for this Thread

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.