summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-04-29 14:39:49 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-05-05 13:34:15 +0000
commit7db59f458b96342f762a0bd9f5218907c026019a (patch)
treed28e8cc7dfc8fd4759520a9e1a2cd71c567faad0 /src/gui/kernel/qwindow.h
parentb8668257e6a6fadf429f65b3bcc6aff0cce063ec (diff)
Add virtual QWindow::closeEvent handler
The default implementation does nothing; the processing of accepted close events remains in the QWidget::event handler, so that subclasses don't have to call the super class in order to free window system resources and emit lastWindowClosed signals. QWidgetWindow::event is reimplemented to handle QEvent::Close as well, calling QWidgetPrivate::close_helper, which then delivers a separate QCloseEvent to the widget. The order of execution for widgets is after this change: 1) QWidgetWindow::event 2) QWidgetWindow::handleCloseEvent (calls QWidget::event/closeEvent) 3) QWindow::event 4) QWindow::closeEvent <- does nothing, not overridden 5) default cleanup handling in QWindow::event and for Qt Quick after the corresponding change in qtdeclarative: 1) QQuickWindow::event 2) QWindow::event 3) QQuickWindow::closeEvent <- emits closed 4) default cleanup handling in QWindow::event [ChangeLog][QtGui][QWindow] closeEvent has been added as a virtual function. Task-number: QTBUG-31019 Change-Id: I201f5ee9c6a73b949986648e3bd288d2c7898f28 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.h')
-rw-r--r--src/gui/kernel/qwindow.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index de6d7ffd31..b7c2af4916 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -69,6 +69,7 @@ class QMoveEvent;
class QResizeEvent;
class QShowEvent;
class QHideEvent;
+class QCloseEvent;
class QKeyEvent;
class QMouseEvent;
#if QT_CONFIG(wheelevent)
@@ -350,7 +351,7 @@ protected:
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
- // TODO Qt 6 - add closeEvent virtual handler
+ virtual void closeEvent(QCloseEvent *);
virtual bool event(QEvent *) override;
virtual void keyPressEvent(QKeyEvent *);