From d6588d20518e6e33fdd5433d8af733657060b11e Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 9 Oct 2012 10:52:44 +0200 Subject: QPlatformWindow: change API for QPlatformWindow::setWindowState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation requests the platform window to set the window state if it can, and return the actual window state back. The problem with this approach is that the platform window is created as late as possible, so a call to QWindow::setWindowState would in many (most?) cases never be forwarded to the platform window (instead, the platform window is responsible to check the current window state upon creation). As such, the window state might be left unsynched with the platform window. This patch suggests removing the return value from QPlatformWindow::setWindowState. This will at least be consistent, so that setting/getting state would produce the same result independent of delayed window creation. If needed, we can later add new API to QPlatformIntegration or QPlatformWindow for querying supported/actual window state. Change-Id: Ie43f56169656854a765ce88b47a808f8f3d51bb4 Reviewed-by: Friedemann Kleint Reviewed-by: Thomas McGuire Reviewed-by: Samuel Rødal Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qplatformwindow.cpp | 5 ++--- src/gui/kernel/qplatformwindow.h | 2 +- src/gui/kernel/qwindow.cpp | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 27dfd7cf40..2bc6b01b3e 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -213,13 +213,12 @@ QPoint QPlatformWindow::mapFromGlobal(const QPoint &pos) const /*! Requests setting the window state of this surface - to \a type. Returns the actual state set. + to \a type. Qt::WindowActive can be ignored. */ -Qt::WindowState QPlatformWindow::setWindowState(Qt::WindowState) +void QPlatformWindow::setWindowState(Qt::WindowState) { - return Qt::WindowNoState; } /*! diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 2b2d227fcf..12650d6073 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -91,7 +91,7 @@ public: virtual void setVisible(bool visible); virtual void setWindowFlags(Qt::WindowFlags flags); - virtual Qt::WindowState setWindowState(Qt::WindowState state); + virtual void setWindowState(Qt::WindowState state); virtual WId winId() const; virtual void setParent(const QPlatformWindow *window); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 39a6603c4b..4f1610cb21 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -828,9 +828,8 @@ void QWindow::setWindowState(Qt::WindowState state) Q_D(QWindow); if (d->platformWindow) - d->windowState = d->platformWindow->setWindowState(state); - else - d->windowState = state; + d->platformWindow->setWindowState(state); + d->windowState = state; } /*! -- cgit v1.2.3