Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.1.0 Beta 1
-
None
-
81b3c4bbb085c9d60dd935e5c74e86988d81dca7
Description
A widget application typically overrides QWidget::closeEvent() and can ignore() the event to prevent closing the window. The typical use case is to open a file dialog and prompt the user to save any unsaved work. In Qt Quick, one could override QWindow::event(), but there is no way to do it with a QML Window { }; and if you try to use C++ for that, you will need to instantiate your subclass of window rather than a plain QQuickWindow, making it non-transparent in QML. So we need to add a similar mechanism, so that in QML it's possible to write an onClosing(closeEvent) handler or something like that, and reject/ignore the event.
Attachments
Issue Links
- relates to
-
QTBUG-40093 In QML onClosing() signal not fires when Window.close() used
- Closed
- resulted in
-
QTBUG-55722 QQuickWindows::closing should be available with no parameter
- Reported
-
QTBUG-33235 OSX: QQuickWindow doesn't get a closeEvent on Cmd+Q
- Closed
For Gerrit Dashboard: QTBUG-31019 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
55457,6 | Add QQuickWindow::closing signal, and ability to ignore the event | stable | qt/qtdeclarative | Status: MERGED | +2 | 0 |
55458,3 | Don't destroy the window if the QCloseEvent wasn't accepted | stable | qt/qtbase | Status: MERGED | +2 | 0 |
298812,5 | Add virtual QWindow::closeEvent handler | dev | qt/qtbase | Status: MERGED | +2 | 0 |