Add QPlatformWindow::isActive(), where the platform
can do further isActive tests, and Windows implementation for it.
Change-Id: I1acfc44d3a4ab36a3aaee52fb7b5f5b40661095e
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
virtual void lower();
virtual bool isExposed() const;
+ virtual bool isActive() const;
virtual void propagateSizeHints();
}
/*!
+ 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.
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
{
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);