summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-10-01 08:30:20 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-10-01 09:06:13 (GMT)
commitfafd16474aee5bbf47ee37e1ba739f3b3ceb9c33 (patch)
tree64f498a5099d275f304cfb948c0ab0c7320ede5a
parentf0183775d1575a4537bed8c10e9c757ffa66fe03 (diff)
downloadQt-fafd16474aee5bbf47ee37e1ba739f3b3ceb9c33.zip
Qt-fafd16474aee5bbf47ee37e1ba739f3b3ceb9c33.tar.gz
Qt-fafd16474aee5bbf47ee37e1ba739f3b3ceb9c33.tar.bz2
Fix for Symbian window activation/focus problem.
When dialog is shown on top of a top level window, the focus does not get back to top level window when dialog is closed. This is a fix for that. Reviewed-by: Shane Kearns
-rw-r--r--src/gui/kernel/qwidget_s60.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 05db8ca..6ba693c 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -490,6 +490,65 @@ void QWidgetPrivate::setFocus_sys()
static_cast<QSymbianControl *>(q->effectiveWinId())->setFocusSafely(true);
}
+void QWidgetPrivate::handleSymbianDeferredFocusChanged()
+{
+ Q_Q(QWidget);
+ WId control = q->internalWinId();
+
+ if (!control) {
+ // This could happen if the widget was reparented, while the focuschange
+ // was in the event queue.
+ return;
+ }
+
+ if (control->IsFocused()) {
+ QApplication::setActiveWindow(q);
+#ifdef Q_WS_S60
+ // If widget is fullscreen, hide status pane and button container
+ // otherwise show them.
+ CEikStatusPane* statusPane = S60->statusPane();
+ CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
+ if (statusPane && (statusPane->IsVisible() == isFullscreen))
+ statusPane->MakeVisible(!isFullscreen);
+ if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen))
+ buttonGroup->MakeVisible(!isFullscreen);
+#endif
+ } else {
+
+ QWidget *nextActiveWindow = 0;
+
+ if (q->isWindow()) {
+
+ // Try to activate possible parent window first.
+ QWidget *parent = q->parentWidget();
+ if(parent
+ && parent->isWindow()
+ && parent->isVisible()
+ && !parent->isActiveWindow()) {
+
+ nextActiveWindow = parent;
+ } else {
+ // Activate next possible top level window.
+ QWidgetList topLevelWidgets = QApplication::topLevelWidgets();
+ for (int i = 0; i < topLevelWidgets.size(); ++i) {
+ QWidget *w = topLevelWidgets.at(i);
+ if (w != q && w->isVisible() && !w->isActiveWindow()) {
+ nextActiveWindow = w;
+ break;
+ }
+ }
+ }
+
+ if (nextActiveWindow)
+ nextActiveWindow->activateWindow();
+ }
+
+ QApplication::setActiveWindow(nextActiveWindow);
+ }
+>>>>>>> Fix for Symbian window activation/focus problem.:src/gui/kernel/qwidget_s60.cpp
+}
+
void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);