diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qplatformwindow.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow_qpa.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.h | 1 |
4 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index d9f79f25eb..cded1fe316 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -102,6 +102,7 @@ public: virtual void lower(); virtual bool isExposed() const; + virtual bool isActive() const; virtual void propagateSizeHints(); diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index 88f2a6481e..d2ec6833b0 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -169,6 +169,17 @@ bool QPlatformWindow::isExposed() const } /*! + Returns true if the window should appear active from a style perspective. + + This function can make platform-specific isActive checks, such as checking + if the QWindow is embedded in an active native window. +*/ +bool QPlatformWindow::isActive() const +{ + return false; +} + +/*! Requests setting the window state of this surface to \a type. Returns the actual state set. diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index aabea04c20..a7140a3d6d 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -807,6 +807,15 @@ bool QWindowsWindow::isVisible() const return m_data.hwnd && IsWindowVisible(m_data.hwnd); } +bool QWindowsWindow::isActive() const +{ + // Check for native windows or children of the active native window. + if (const HWND activeHwnd = GetActiveWindow()) + if (m_data.hwnd == activeHwnd || IsChild(activeHwnd, m_data.hwnd)) + return true; + return false; +} + // partially from QWidgetPrivate::show_sys() void QWindowsWindow::show_sys() const { diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 743e10dff9..182bef78e4 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -150,6 +150,7 @@ public: virtual void setVisible(bool visible); bool isVisible() const; + virtual bool isActive() const; virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); virtual Qt::WindowState setWindowState(Qt::WindowState state); |