summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/qcloseevent.3qt
blob: 03ed11727040069bfb389908a91a34b15acb553f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'\" t
.TH QCloseEvent 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QCloseEvent \- Parameters that describe a close event
.SH SYNOPSIS
\fC#include <qevent.h>\fR
.PP
Inherits QEvent.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQCloseEvent\fR ()"
.br
.ti -1c
.BI "bool \fBisAccepted\fR () const"
.br
.ti -1c
.BI "void \fBaccept\fR ()"
.br
.ti -1c
.BI "void \fBignore\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QCloseEvent class contains parameters that describe a close event.
.PP
Close events are sent to widgets that the user wants to close, usually by choosing "Close" from the window menu, or by clicking the `X' titlebar button. They are also sent when you call QWidget::close() to close a widget programmatically.
.PP
Close events contain a flag that indicates whether the receiver wants the widget to be closed or not. When a widget accepts the close event, it is hidden (and destroyed if it was created with the WDestructiveClose flag). If it refuses to accept the close event nothing happens. (Under X11 it is possible that the window manager will forcibly close the window; but at the time of writing we are not aware of any window manager that does this.)
.PP
The application's main widget -- QApplication::mainWidget() -- is a special case. When it accepts the close event, Qt leaves the main event loop and the application is immediately terminated (i.e. it returns from the call to QApplication::exec() in the main() function).
.PP
The event handler QWidget::closeEvent() receives close events. The default implementation of this event handler accepts the close event. If you do not want your widget to be hidden, or want some special handing, you should reimplement the event handler.
.PP
The closeEvent() in the Application Walkthrough shows a close event handler that asks whether to save a document before closing.
.PP
If you want the widget to be deleted when it is closed, create it with the WDestructiveClose widget flag. This is very useful for independent top-level windows in a multi-window application.
.PP
QObjects emits the destroyed() signal when they are deleted.
.PP
If the last top-level window is closed, the QApplication::lastWindowClosed() signal is emitted.
.PP
The isAccepted() function returns TRUE if the event's receiver has agreed to close the widget; call accept() to agree to close the widget and call ignore() if the receiver of this event does not want the widget to be closed.
.PP
See also QWidget::close(), QWidget::hide(), QObject::destroyed(), QApplication::setMainWidget(), QApplication::lastWindowClosed(), QApplication::exec(), QApplication::tquit(), and Event Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QCloseEvent::QCloseEvent ()"
Constructs a close event object with the accept parameter flag set to FALSE.
.PP
See also accept().
.SH "void QCloseEvent::accept ()"
Sets the accept flag of the close event object.
.PP
Setting the accept flag indicates that the receiver of this event agrees to close the widget.
.PP
The accept flag is \fInot\fR set by default.
.PP
If you choose to accept in QWidget::closeEvent(), the widget will be hidden. If the widget's WDestructiveClose flag is set, it will also be destroyed.
.PP
See also ignore() and QWidget::hide().
.PP
Examples:
.)l action/application.cpp, application/application.cpp, mdi/application.cpp, popup/popup.cpp, and qwerty/qwerty.cpp.
.SH "void QCloseEvent::ignore ()"
Clears the accept flag of the close event object.
.PP
Clearing the accept flag indicates that the receiver of this event does not want the widget to be closed.
.PP
The close event is constructed with the accept flag cleared.
.PP
See also accept().
.PP
Examples:
.)l action/application.cpp, application/application.cpp, mdi/application.cpp, and qwerty/qwerty.cpp.
.SH "bool QCloseEvent::isAccepted () const"
Returns TRUE if the receiver of the event has agreed to close the widget; otherwise returns FALSE.
.PP
See also accept() and ignore().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/qcloseevent.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qcloseevent.3qt) and the Qt
version (3.3.8).