1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qevent.cpp:1392 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QCloseEvent Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QCloseEvent Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QCloseEvent class contains parameters that describe a close event.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qevent-h.html">qevent.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qevent.html">QEvent</a>.
|
---|
38 | <p><a href="qcloseevent-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn><a href="#QCloseEvent"><b>QCloseEvent</b></a> ()</li>
|
---|
42 | <li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
|
---|
43 | <li class=fn>void <a href="#accept"><b>accept</b></a> ()</li>
|
---|
44 | <li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
|
---|
45 | </ul>
|
---|
46 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
47 |
|
---|
48 |
|
---|
49 | The QCloseEvent class contains parameters that describe a close event.
|
---|
50 | <p>
|
---|
51 | <p> Close events are sent to widgets that the user wants to close,
|
---|
52 | usually by choosing "Close" from the window menu, or by clicking
|
---|
53 | the `X' titlebar button. They are also sent when you call
|
---|
54 | <a href="qwidget.html#close">QWidget::close</a>() to close a widget programmatically.
|
---|
55 | <p> Close events contain a flag that indicates whether the receiver
|
---|
56 | wants the widget to be closed or not. When a widget accepts the
|
---|
57 | close event, it is hidden (and destroyed if it was created with
|
---|
58 | the <a href="qt.html#WidgetFlags-enum">WDestructiveClose</a> flag). If it refuses to accept the close
|
---|
59 | event nothing happens. (Under X11 it is possible that the window
|
---|
60 | manager will forcibly close the window; but at the time of writing
|
---|
61 | we are not aware of any window manager that does this.)
|
---|
62 | <p> The application's main widget -- <a href="qapplication.html#mainWidget">QApplication::mainWidget</a>() --
|
---|
63 | is a special case. When it accepts the close event, Qt leaves the
|
---|
64 | main event loop and the application is immediately terminated
|
---|
65 | (i.e. it returns from the call to <a href="qapplication.html#exec">QApplication::exec</a>() in the
|
---|
66 | main() function).
|
---|
67 | <p> The event handler <a href="qwidget.html#closeEvent">QWidget::closeEvent</a>() receives close events. The
|
---|
68 | default implementation of this event handler accepts the close
|
---|
69 | event. If you do not want your widget to be hidden, or want some
|
---|
70 | special handing, you should reimplement the event handler.
|
---|
71 | <p> The <a href="simple-application.html#closeEvent">closeEvent() in the
|
---|
72 | Application Walkthrough</a> shows a close event handler that
|
---|
73 | asks whether to save a document before closing.
|
---|
74 | <p> If you want the widget to be deleted when it is closed, create it
|
---|
75 | with the <a href="qt.html#WidgetFlags-enum">WDestructiveClose</a> widget flag. This is very useful for
|
---|
76 | independent top-level windows in a multi-window application.
|
---|
77 | <p> <a href="qobject.html">QObject</a>s emits the <a href="qobject.html#destroyed">destroyed()</a> signal when they are deleted.
|
---|
78 | <p> If the last top-level window is closed, the
|
---|
79 | <a href="qapplication.html#lastWindowClosed">QApplication::lastWindowClosed</a>() signal is emitted.
|
---|
80 | <p> The <a href="#isAccepted">isAccepted</a>() function returns TRUE if the event's receiver has
|
---|
81 | agreed to close the widget; call <a href="#accept">accept</a>() to agree to close the
|
---|
82 | widget and call <a href="#ignore">ignore</a>() if the receiver of this event does not
|
---|
83 | want the widget to be closed.
|
---|
84 | <p> <p>See also <a href="qwidget.html#close">QWidget::close</a>(), <a href="qwidget.html#hide">QWidget::hide</a>(), <a href="qobject.html#destroyed">QObject::destroyed</a>(), <a href="qapplication.html#setMainWidget">QApplication::setMainWidget</a>(), <a href="qapplication.html#lastWindowClosed">QApplication::lastWindowClosed</a>(), <a href="qapplication.html#exec">QApplication::exec</a>(), <a href="qapplication.html#quit">QApplication::quit</a>(), and <a href="events.html">Event Classes</a>.
|
---|
85 |
|
---|
86 | <hr><h2>Member Function Documentation</h2>
|
---|
87 | <h3 class=fn><a name="QCloseEvent"></a>QCloseEvent::QCloseEvent ()
|
---|
88 | </h3>
|
---|
89 |
|
---|
90 | <p> Constructs a close event object with the accept parameter flag set
|
---|
91 | to FALSE.
|
---|
92 | <p> <p>See also <a href="#accept">accept</a>().
|
---|
93 |
|
---|
94 | <h3 class=fn>void <a name="accept"></a>QCloseEvent::accept ()
|
---|
95 | </h3>
|
---|
96 |
|
---|
97 | <p> Sets the accept flag of the close event object.
|
---|
98 | <p> Setting the accept flag indicates that the receiver of this event
|
---|
99 | agrees to close the widget.
|
---|
100 | <p> The accept flag is <em>not</em> set by default.
|
---|
101 | <p> If you choose to accept in <a href="qwidget.html#closeEvent">QWidget::closeEvent</a>(), the widget will
|
---|
102 | be hidden. If the widget's <a href="qt.html#WidgetFlags-enum">WDestructiveClose</a> flag is set, it
|
---|
103 | will also be destroyed.
|
---|
104 | <p> <p>See also <a href="#ignore">ignore</a>() and <a href="qwidget.html#hide">QWidget::hide</a>().
|
---|
105 |
|
---|
106 | <p>Examples: <a href="qaction-application-example.html#x1128">action/application.cpp</a>, <a href="simple-application-example.html#x1545">application/application.cpp</a>, <a href="mdi-example.html#x2021">mdi/application.cpp</a>, <a href="popup-example.html#x1607">popup/popup.cpp</a>, and <a href="qwerty-example.html#x360">qwerty/qwerty.cpp</a>.
|
---|
107 | <h3 class=fn>void <a name="ignore"></a>QCloseEvent::ignore ()
|
---|
108 | </h3>
|
---|
109 |
|
---|
110 | <p> Clears the accept flag of the close event object.
|
---|
111 | <p> Clearing the accept flag indicates that the receiver of this event
|
---|
112 | does not want the widget to be closed.
|
---|
113 | <p> The close event is constructed with the accept flag cleared.
|
---|
114 | <p> <p>See also <a href="#accept">accept</a>().
|
---|
115 |
|
---|
116 | <p>Examples: <a href="qaction-application-example.html#x1129">action/application.cpp</a>, <a href="simple-application-example.html#x1546">application/application.cpp</a>, <a href="mdi-example.html#x2022">mdi/application.cpp</a>, and <a href="qwerty-example.html#x361">qwerty/qwerty.cpp</a>.
|
---|
117 | <h3 class=fn>bool <a name="isAccepted"></a>QCloseEvent::isAccepted () const
|
---|
118 | </h3>
|
---|
119 |
|
---|
120 | <p> Returns TRUE if the receiver of the event has agreed to close the
|
---|
121 | widget; otherwise returns FALSE.
|
---|
122 | <p> <p>See also <a href="#accept">accept</a>() and <a href="#ignore">ignore</a>().
|
---|
123 |
|
---|
124 | <!-- eof -->
|
---|
125 | <hr><p>
|
---|
126 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
127 | Copyright © 1995-2007
|
---|
128 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
129 | <table width=100% cellspacing=0 border=0><tr>
|
---|
130 | <td>Copyright © 2007
|
---|
131 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
132 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
133 | </table></div></address></body>
|
---|
134 | </html>
|
---|