summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-03-24 10:10:06 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-03-24 15:18:55 (GMT)
commite18eac95ad4b69ebe53e51c65416f1c94275e10a (patch)
tree6f5177f283d2e51e3fdf5081d981547b7dbd2bca /src/gui/kernel/qapplication.cpp
parent7f147cf30e8c72ed4c452de31f4b5f853dbe9e4f (diff)
downloadQt-e18eac95ad4b69ebe53e51c65416f1c94275e10a.zip
Qt-e18eac95ad4b69ebe53e51c65416f1c94275e10a.tar.gz
Qt-e18eac95ad4b69ebe53e51c65416f1c94275e10a.tar.bz2
Fixes a focusWidget when showing a toplevel that accepts keyboard input.
When a toplevel window is the widget that can accept keyboard input, it doesn't get focus when shown. The fix is to check if the toplevel is activated and noone has focus, then give focus to the toplevel itself. Reviewed-by: Brad Task-number: 244607
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r--src/gui/kernel/qapplication.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 1bbb019..7e59fad 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2461,7 +2461,9 @@ void QApplication::setActiveWindow(QWidget* act)
} else {
// If the focus widget is not in the activate_window, clear the focus
w = QApplicationPrivate::focus_widget;
- if (w && !QApplicationPrivate::active_window->isAncestorOf(w))
+ if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus)
+ QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason);
+ else if (!QApplicationPrivate::active_window->isAncestorOf(w))
QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
}
}