Add focusWindowChanged signal to QGuiApplication

Required for Cocoa platform menus support, we need a
way to update state after focusWindow() result changes.

Change-Id: Idc573888c3d75bcbff2252e243c4b57b15fc2fcd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
James Turner 2012-04-13 10:57:43 +01:00 committed by Qt by Nokia
parent 9487acb9d2
commit 617c026d65
2 changed files with 10 additions and 0 deletions

View File

@ -520,6 +520,13 @@ QWindow *QGuiApplication::focusWindow()
\sa focusObject()
*/
/*!
\fn QGuiApplication::focusWindowChanged(QWindow *focusWindow)
This signal is emitted when the focused window changes.
\sa focusWindow()
*/
/*!
Returns the QObject in currently active window that will be final receiver of events
tied to focus, such as key events.
@ -1337,6 +1344,8 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (previousFocusObject != qApp->focusObject())
self->q_updateFocusObject(qApp->focusObject());
}
emit qApp->focusWindowChanged(newFocus);
}
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)

View File

@ -148,6 +148,7 @@ Q_SIGNALS:
void screenAdded(QScreen *screen);
void lastWindowClosed();
void focusObjectChanged(QObject *focusObject);
void focusWindowChanged(QWindow *focusWindow);
protected:
bool event(QEvent *);