Add QPlatformWindow::close()
Platforms can reimplement this function to control how non-spontaneous window close is handled. Make QWindow::close() call this function. Change-Id: I3da13e6c8519de2af7e54334d8a1e833ce98cba1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
b949c44783
commit
2f9bdeba17
|
|
@ -339,6 +339,20 @@ void QPlatformWindow::setWindowFilePath(const QString &filePath) { Q_UNUSED(file
|
|||
*/
|
||||
void QPlatformWindow::setWindowIcon(const QIcon &icon) { Q_UNUSED(icon); }
|
||||
|
||||
/*!
|
||||
Reimplement to let the platform handle non-spontaneous window close.
|
||||
|
||||
When reimplementing make sure to call the base class implementation
|
||||
or QWindowSystemInterface::handleCloseEvent(), which will prompt the
|
||||
user to accept the window close (if needed) and then close the QWindow.
|
||||
*/
|
||||
bool QPlatformWindow::close()
|
||||
{
|
||||
bool accepted = false;
|
||||
QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(window(), &accepted);
|
||||
return accepted;
|
||||
}
|
||||
|
||||
/*!
|
||||
Reimplement to be able to let Qt raise windows to the top of the desktop
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ public:
|
|||
virtual void setWindowTitle(const QString &title);
|
||||
virtual void setWindowFilePath(const QString &title);
|
||||
virtual void setWindowIcon(const QIcon &icon);
|
||||
virtual bool close();
|
||||
virtual void raise();
|
||||
virtual void lower();
|
||||
|
||||
|
|
|
|||
|
|
@ -2144,10 +2144,7 @@ bool QWindow::close()
|
|||
if (!d->platformWindow)
|
||||
return true;
|
||||
|
||||
bool accepted = false;
|
||||
QWindowSystemInterface::handleCloseEvent(this, &accepted);
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
return accepted;
|
||||
return d->platformWindow->close();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue