diff options
author | axis <qt-info@nokia.com> | 2009-11-11 13:05:27 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-12 12:29:15 (GMT) |
commit | 42d990bde3ea5e825d90d245a958c7faf7a6aa5b (patch) | |
tree | 5d113787fd99c2c6f88f028950a90cbd49891859 /src/gui/kernel | |
parent | 929dd1e7bc02c51e324425a79243f0ff08fb1508 (diff) | |
download | Qt-42d990bde3ea5e825d90d245a958c7faf7a6aa5b.zip Qt-42d990bde3ea5e825d90d245a958c7faf7a6aa5b.tar.gz Qt-42d990bde3ea5e825d90d245a958c7faf7a6aa5b.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
Diffstat (limited to 'src/gui/kernel')
-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 0c2099b..dd2ccf2 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 3ae76ae..d45c34a 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. |