QCloseEvent - Parameters that describe a close event
#include <qevent.h>
Inherits QEvent.
Public Members
QCloseEvent ()
bool isAccepted () const
void accept ()
void ignore ()
DESCRIPTION
The QCloseEvent class contains parameters that describe a
close event.
Close events are sent to widgets that the user wants to
close, usually by choosing "Close" from the window menu.
They are also sent when you call QWidget::close() to close
a widget from inside the program.
Close events contain a special accept flag which tells
whether the receiver wants the widget to be closed. When a
widget accepts the close event, it is hidden. If it
refuses to accept the close event, either nothing happens
or it is forcibly closed, if the sender of the close event
really wants to.
The main widget of the application -
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
back from the call to QApplication::exec() in your main()
function).
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 need to
reimplement the event handler.
The closeEvent() in the Application Walkthrough shows a
close event handler that asks whether to save the document
before closing.
If you want your widget also to be deleted when it is
closed, simply create it with the WDestructiveClose widget
flag. This is very useful for the independent top-level
windows of a multi window application. The Application
Walkthrough example uses this too.
QObject emits the destroyed() signal when it is deleted.
another widget is deleted.
If the last toplevel window is closed, the
QApplication::lastWindowClosed() signal is emitted.
See also QWidget::close(), QWidget::hide(),
QObject::destroyed(), QApplication::setMainWidget(),
QApplication::lastWindowClosed(), QApplication::exec() and
QApplication::quit().
Examples: popup/popup.cpp
MEMBER FUNCTION DOCUMENTATION
QCloseEvent::QCloseEvent ()
Constructs a close event object with the accept parameter
flag set to FALSE.
void QCloseEvent::accept ()
Sets the accept flag of the close event object.
Setting the accept flag indicates that the receiver of
this event agrees to close the widget.
The accept flag is not set by default.
If you choose to accept in QWidget::closeEvent(), the
widget will be hidden. If the widget's WDestructiveClose
flag is set, it is also destroyed.
See also ignore() and QWidget::hide().
Examples: popup/popup.cpp
void QCloseEvent::ignore ()
Clears the accept flag of the close event object.
Clearing the accept flag indicates that the receiver of
this event does not want the widget to be closed.
The accept flag is not set by default.
See also accept().
bool QCloseEvent::isAccepted () const
Returns TRUE if the receiver of the event has agreed to
close the widget.
See also accept() and ignore().
SEE ALSO
http://doc.trolltech.com/qcloseevent.html
http://www.trolltech.com/faq/tech.html
Copyright 1992-2001 Trolltech AS,
http://www.trolltech.com. See the license file included
in the distribution for a complete license statement.
AUTHOR
Generated automatically from the source code.
BUGS
If you find a bug in Qt, please report it as described in
http://doc.trolltech.com/bughowto.html. Good bug reports
make our job much simpler. Thank you.
In case of content or formattting problems with this
manual page, please report them to qt-bugs@trolltech.com.
Please include the name of the manual page
(qcloseevent.3qt) and the Qt version (2.3.1).
Man(1) output converted with
man2html