diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-12-09 17:29:25 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-02 15:08:19 +0100 |
commit | a23a5487eb60c0f8b3c99d32a5e8e3cf636e4911 (patch) | |
tree | 4b2a13a7a1906ff39a5a7c7b9d422803db0affa6 /src/gui | |
parent | 16696ce49373d3ea2b4d12e28b85ca3275f73b82 (diff) |
Send ApplicationActivate and ApplicationDeactivate from QtGui.
Instead of only from QApplication in QtWidgets, as we need these events
for example in QDeclarativeApplication.
Task-number: QTBUG-21573
Task-number: QTBUG-23331
Change-Id: I0c960bd1c7911d306d274a6e9a1838f158235ed0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f669a8f3d5..c3dddddf3b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -753,9 +753,6 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e) { - if (!e->activated) - return; - QWindow *previous = QGuiApplicationPrivate::focus_window; QGuiApplicationPrivate::focus_window = e->activated.data(); @@ -765,10 +762,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate if (previous) { QFocusEvent focusOut(QEvent::FocusOut); QCoreApplication::sendSpontaneousEvent(previous, &focusOut); + } else { + QEvent appActivate(QEvent::ApplicationActivate); + qApp->sendSpontaneousEvent(qApp, &appActivate); } - QFocusEvent focusIn(QEvent::FocusIn); - QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn); + if (QGuiApplicationPrivate::focus_window) { + QFocusEvent focusIn(QEvent::FocusIn); + QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn); + } else { + QEvent appActivate(QEvent::ApplicationDeactivate); + qApp->sendSpontaneousEvent(qApp, &appActivate); + } if (self) self->notifyActiveWindowChange(previous); |