User Tools

Site Tools


qt:quitting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
qt:quitting [2011/03/30 22:14] – created mithatqt:quitting [2011/03/31 10:06] (current) – [Quitting] mithat
Line 1: Line 1:
 ====== Quitting ====== ====== Quitting ======
  
-There are quite a few ways to terminate a Qt app that you might wonder what the BlessedHolyWay is. I'm not sure that I've figured that out, but for now I will document the different ways that are available of which I am aware.+There are a few ways to terminate a Qt app and so you might wonder what the BlessedHolyWay is. I'm not sure that I've figured that out, but for now I will document the different ways that are available of which I am aware.
  
 ===== QApplication::lastWindowClosed() ===== ===== QApplication::lastWindowClosed() =====
Line 10: Line 10:
  
 By default, By default,
-  * this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus +  * //This attribute is set for all widgets// except transient windows such as splash screens, tool windows, and popup menus. 
-  * QApplication implicitly quits when this signal is emitted. +  * //QApplication implicitly quits when this signal is emitted.// This feature can be turned off by setting ''quitOnLastWindowClosed'' to ''false''.((http://doc.trolltech.com/latest/qapplication.html#lastWindowClosed, emphasis added.))
-This feature can be turned off by setting ''quitOnLastWindowClosed'' to ''false''.((http://doc.trolltech.com/latest/qapplication.html#lastWindowClosed))+
  
 So, one way to quit your app is to direct an event or action handler to the slot <code cpp>bool QWidget::close ()</code> So, one way to quit your app is to direct an event or action handler to the slot <code cpp>bool QWidget::close ()</code>
Line 46: Line 45:
  
 <code cpp>void QCoreApplication::quit () [static slot]</code> <code cpp>void QCoreApplication::quit () [static slot]</code>
-Tells the application to exit with return code 0 (success). Equivalent to calling QCoreApplication::exit(0).+Tells the application to exit with return code 0 (success). Equivalent to calling ''QCoreApplication::exit(0)''.
  
-It's common to connect the ''QApplication::lastWindowClosed()'' signal to ''quit()'', and you also often connect e.g. QAbstractButton::clicked() or signals in QAction, QMenu, or QMenuBar to it.+It's common to connect the ''QApplication::lastWindowClosed()'' signal to ''quit()'', and you also often connect e.g. ''QAbstractButton::clicked()'' or signals in ''QAction''''QMenu'', or ''QMenuBar'' to it.
  
 Example:<code cpp> Example:<code cpp>
Line 54: Line 53:
 connect(quitButton, SIGNAL(clicked()), &app, SLOT(quit()));</code>((http://doc.trolltech.com/latest/qcoreapplication.html#quit)) connect(quitButton, SIGNAL(clicked()), &app, SLOT(quit()));</code>((http://doc.trolltech.com/latest/qcoreapplication.html#quit))
  
- 
- 
- 
- 
- 
- 
- 
-See also QWidget::close(). 
  
  
qt/quitting.1301523275.txt.gz · Last modified: 2011/03/30 22:14 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki