1QCloseEvent(3qt) QCloseEvent(3qt)
2
3
4
6 QCloseEvent - Parameters that describe a close event
7
9 #include <qevent.h>
10
11 Inherits QEvent.
12
13 Public Members
14 QCloseEvent ()
15 bool isAccepted () const
16 void accept ()
17 void ignore ()
18
20 The QCloseEvent class contains parameters that describe a close event.
21
22 Close events are sent to widgets that the user wants to close, usually
23 by choosing "Close" from the window menu, or by clicking the `X'
24 titlebar button. They are also sent when you call QWidget::close() to
25 close a widget programmatically.
26
27 Close events contain a flag that indicates whether the receiver wants
28 the widget to be closed or not. When a widget accepts the close event,
29 it is hidden (and destroyed if it was created with the
30 WDestructiveClose flag). If it refuses to accept the close event
31 nothing happens. (Under X11 it is possible that the window manager will
32 forcibly close the window; but at the time of writing we are not aware
33 of any window manager that does this.)
34
35 The application's main widget -- QApplication::mainWidget() -- is a
36 special case. When it accepts the close event, Qt leaves the main event
37 loop and the application is immediately terminated (i.e. it returns
38 from the call to QApplication::exec() in the main() function).
39
40 The event handler QWidget::closeEvent() receives close events. The
41 default implementation of this event handler accepts the close event.
42 If you do not want your widget to be hidden, or want some special
43 handing, you should reimplement the event handler.
44
45 The closeEvent() in the Application Walkthrough shows a close event
46 handler that asks whether to save a document before closing.
47
48 If you want the widget to be deleted when it is closed, create it with
49 the WDestructiveClose widget flag. This is very useful for independent
50 top-level windows in a multi-window application.
51
52 QObjects emits the destroyed() signal when they are deleted.
53
54 If the last top-level window is closed, the
55 QApplication::lastWindowClosed() signal is emitted.
56
57 The isAccepted() function returns TRUE if the event's receiver has
58 agreed to close the widget; call accept() to agree to close the widget
59 and call ignore() if the receiver of this event does not want the
60 widget to be closed.
61
62 See also QWidget::close(), QWidget::hide(), QObject::destroyed(),
63 QApplication::setMainWidget(), QApplication::lastWindowClosed(),
64 QApplication::exec(), QApplication::quit(), and Event Classes.
65
68 Constructs a close event object with the accept parameter flag set to
69 FALSE.
70
71 See also accept().
72
74 Sets the accept flag of the close event object.
75
76 Setting the accept flag indicates that the receiver of this event
77 agrees to close the widget.
78
79 The accept flag is not set by default.
80
81 If you choose to accept in QWidget::closeEvent(), the widget will be
82 hidden. If the widget's WDestructiveClose flag is set, it will also be
83 destroyed.
84
85 See also ignore() and QWidget::hide().
86
87 Examples:
88
90 Clears the accept flag of the close event object.
91
92 Clearing the accept flag indicates that the receiver of this event does
93 not want the widget to be closed.
94
95 The close event is constructed with the accept flag cleared.
96
97 See also accept().
98
99 Examples:
100
102 Returns TRUE if the receiver of the event has agreed to close the
103 widget; otherwise returns FALSE.
104
105 See also accept() and ignore().
106
107
109 http://doc.trolltech.com/qcloseevent.html
110 http://www.trolltech.com/faq/tech.html
111
113 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
114 license file included in the distribution for a complete license
115 statement.
116
118 Generated automatically from the source code.
119
121 If you find a bug in Qt, please report it as described in
122 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
123 help you. Thank you.
124
125 The definitive Qt documentation is provided in HTML format; it is
126 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
127 web browser. This man page is provided as a convenience for those users
128 who prefer man pages, although this format is not officially supported
129 by Trolltech.
130
131 If you find errors in this manual page, please report them to qt-
132 bugs@trolltech.com. Please include the name of the manual page
133 (qcloseevent.3qt) and the Qt version (3.3.8).
134
135
136
137Trolltech AS 2 February 2007 QCloseEvent(3qt)