diff options
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index a66420c364..bc1aeb8217 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -340,6 +340,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 */ void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } @@ -710,7 +724,7 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, QPlatformWindow subclasses can re-implement this function to provide display refresh synchronized updates. The event - should be delivered using QWindowPrivate::deliverUpdateRequest() + should be delivered using QPlatformWindow::deliverUpdateRequest() to not get out of sync with the the internal state of QWindow. The default implementation posts an UpdateRequest event to the @@ -729,12 +743,28 @@ void QPlatformWindow::requestUpdate() } QWindow *w = window(); - QWindowPrivate *wp = (QWindowPrivate *) QObjectPrivate::get(w); + QWindowPrivate *wp = qt_window_private(w); Q_ASSERT(wp->updateTimer == 0); wp->updateTimer = w->startTimer(timeout, Qt::PreciseTimer); } /*! + Delivers an QEvent::UpdateRequest event to the window. + + QPlatformWindow subclasses can re-implement this function to + provide e.g. logging or tracing of the delivery, but should + always call the base class function. +*/ +void QPlatformWindow::deliverUpdateRequest() +{ + QWindow *w = window(); + QWindowPrivate *wp = qt_window_private(w); + wp->updateRequestPending = false; + QEvent request(QEvent::UpdateRequest); + QCoreApplication::sendEvent(w, &request); +} + +/*! Returns the QWindow minimum size. */ QSize QPlatformWindow::windowMinimumSize() const |