summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_s60.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-09-01 09:47:09 (GMT)
committeraxis <qt-info@nokia.com>2010-09-01 13:04:40 (GMT)
commitf0ec1d2ec229f5a2c47dfa9392a2625da25fc69f (patch)
tree24c72d0a00f3bf8badaf739b039116c1ea0f62a8 /src/gui/kernel/qapplication_s60.cpp
parent52cf47565e402dc682038ccaf8d725401802b603 (diff)
downloadQt-f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f.zip
Qt-f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f.tar.gz
Qt-f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f.tar.bz2
Fixed a case where a newly created native widget would lose focus.
If a native control was created for a child widget, it would receive the FocusChanged signal in its QSymbianControl with a value of not- focused. This would lead the code to deactivate the whole toplevel window. This was fixed by having Qt traverse the widget chain up to the toplevel and check if parent widgets are also not focused. AutoTest: Included and passed RevBy: Denis Dzyubenko RevBy: mread
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 7c5e790..7408360 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1242,17 +1242,28 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
- if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
- QWidget *fw = QApplication::focusWidget();
- if (fw) {
- QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
- QCoreApplication::sendEvent(fw, &event);
- }
- m_symbianPopupIsOpen = true;
- return;
+ bool focusedControlFound = false;
+ WId winId = 0;
+ for (QWidget *w = qwidget->parentWidget(); w && (winId = w->internalWinId()); w = w->parentWidget()) {
+ if (winId->IsFocused() && winId->IsVisible()) {
+ focusedControlFound = true;
+ break;
+ } else if (w->isWindow())
+ break;
}
+ if (!focusedControlFound) {
+ if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
+ QWidget *fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
+ QCoreApplication::sendEvent(fw, &event);
+ }
+ m_symbianPopupIsOpen = true;
+ return;
+ }
- QApplication::setActiveWindow(0);
+ QApplication::setActiveWindow(0);
+ }
}
// else { We don't touch the active window unless we were explicitly activated or deactivated }
}