Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QWidget::closeEvent ( QCloseEvent event  )  [protected, virtual, inherited]

This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system.

By default, the event is accepted and the widget is closed. You can reimplement this function to change the way the widget responds to window close requests. For example, you can prevent the window from closing by calling {QEvent::}{ignore()} on all events.

Main window applications typically use reimplementations of this function to check whether the user's work has been saved and ask for permission before closing. For example, the {Application Example} uses a helper function to determine whether or not to close the window:

mainwindows/application/mainwindow.cpp 3 mainwindows/application/mainwindow.cpp 4

See also:
event(), hide(), close(), QCloseEvent, {Application Example}

Reimplemented in BrowserMainWindow, TextEdit, MainWindow, MainWindow, Window, MainWindow, MainWindow, MainWindow, MainWindow, MainWindow, MainWindow, QDialog, QMessageBox, QProgressDialog, QAbstractSpinBox, QDockWidget, QMdiSubWindow, Q3ProgressDialog, MainWindow, MainWindow, and MainWindow.

Definition at line 8014 of file qwidget.cpp.

Referenced by QAbstractSpinBox::closeEvent(), QDockWidget::closeEvent(), and QWidget::event().

{
    event->accept();
}


Generated by  Doxygen 1.6.0   Back to index