Class QCloseEvent

  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QEvent
                  extended by com.trolltech.qt.gui.QCloseEvent
All Implemented Interfaces:

public class QCloseEvent
extends QEvent

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, or by clicking the X title bar button. They are also sent when you call QWidget::close() to close a widget programmatically.

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 Qt::WA_DeleteOnClose 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.)

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 and ignore() the event.

The closeEvent() in the Application example shows a close event handler that asks whether to save a document before closing.

If you want the widget to be deleted when it is closed, create it with the Qt::WA_DeleteOnClose flag. This is very useful for independent top-level windows in a multi-window application.

QObjects emits the destroyed() signal when they are deleted.

If the last top-level window is closed, the QApplication::lastWindowClosed() signal is emitted.

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.

See also:
QWidget::close(), QWidget::hide(), QObject::destroyed(), QCoreApplication::exec(), QCoreApplication::quit(), and QApplication::lastWindowClosed() .

Nested Class Summary
Nested classes/interfaces inherited from class com.trolltech.qt.core.QEvent
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
Field Summary
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
Constructor Summary
          Constructs a close event object.
Method Summary
 java.lang.String toString()
          Returns a string representation of the this QCloseEvent.
Methods inherited from class com.trolltech.qt.core.QEvent
accept, ignore, isAccepted, registerEventType, registerEventType, setAccepted, setT, spontaneous, t, type
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership

Constructor Detail


public QCloseEvent()
Constructs a close event object.

See also:

Method Detail


public java.lang.String toString()
Returns a string representation of the this QCloseEvent.

toString in class QEvent