diff options
author | axis <qt-info@nokia.com> | 2009-11-11 13:05:27 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-11-18 05:59:15 (GMT) |
commit | 267bfcf263fae15e6701f361af5f89f90679d712 (patch) | |
tree | 295e41a9b97e34f3bc1a8c921e8772bc0db93f9f /src/gui | |
parent | d2f2598e888903830e86052819bdd183b6fda547 (diff) | |
download | Qt-267bfcf263fae15e6701f361af5f89f90679d712.zip Qt-267bfcf263fae15e6701f361af5f89f90679d712.tar.gz Qt-267bfcf263fae15e6701f361af5f89f90679d712.tar.bz2 |
Fixed a focusing bug on Symbian.
When Symbian pops up a menu or dialog, Qt should produce FocusOut
events using PopupFocusReason rather than deactivating the whole
window. This keeps input widgets from losing focus when FEP wants to
pop up dialogs.
AutoTest: QWidget passed
RevBy: Jason Barron
(cherry picked from commit 42d990bde3ea5e825d90d245a958c7faf7a6aa5b)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 191d4a1..04e4b31 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -324,6 +324,7 @@ QSymbianControl::QSymbianControl(QWidget *w) , m_longTapDetector(0) , m_ignoreFocusChanged(0) , m_previousEventLongTap(0) + , m_symbianPopupIsOpen(0) { } @@ -915,6 +916,15 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) return; if (IsFocused() && IsVisible()) { + if (m_symbianPopupIsOpen) { + QWidget *fw = QApplication::focusWidget(); + if (fw) { + QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); + QCoreApplication::sendEvent(fw, &event); + } + m_symbianPopupIsOpen = false; + } + QApplication::setActiveWindow(qwidget->window()); #ifdef Q_WS_S60 // If widget is fullscreen, hide status pane and button container @@ -928,6 +938,16 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) buttonGroup->MakeVisible(!isFullscreen); #endif } else if (QApplication::activeWindow() == qwidget->window()) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { + QWidget *fw = QApplication::focusWidget(); + if (fw) { + QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QCoreApplication::sendEvent(fw, &event); + } + m_symbianPopupIsOpen = true; + return; + } + QApplication::setActiveWindow(0); } // else { We don't touch the active window unless we were explicitly activated or deactivated } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 3b5ce82..8e98d06 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -205,6 +205,7 @@ private: QLongTapTimer* m_longTapDetector; bool m_ignoreFocusChanged : 1; bool m_previousEventLongTap : 1; + bool m_symbianPopupIsOpen : 1; #ifdef Q_WS_S60 // Fader object used to fade everything except this menu and the CBA. |