diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-05 08:09:00 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-05 08:09:00 (GMT) |
commit | bb587db95d7c20344c0bf06a1f080c0a2e4a9250 (patch) | |
tree | 50c4615c0c5908bb5a26c1a3ee121dd1f7f070be /src/gui/kernel/qwidget.cpp | |
parent | f26f5b230e614faecce33cf52af0a0d62dcaddaa (diff) | |
parent | 555018baf3115cb2587d2217bf1a5b8f49564ad2 (diff) | |
download | Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.zip Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.tar.gz Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 59bb600..fb2e219 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5677,10 +5677,15 @@ void QWidget::setFocus(Qt::FocusReason reason) w = w->isWindow() ? 0 : w->parentWidget(); } } else { - while (w) { + while (w && w->isVisible()) { w->d_func()->focus_child = f; w = w->isWindow() ? 0 : w->parentWidget(); } + // a special case, if there is an invisible parent, notify him + // about the focus_child widget, so that if it becomes + // visible, the focus widget will be respected. + if (w) + w->d_func()->focus_child = f; } #ifndef QT_NO_GRAPHICSVIEW @@ -6732,6 +6737,10 @@ void QWidgetPrivate::show_helper() if (QApplicationPrivate::hidden_focus_widget == q) { QApplicationPrivate::hidden_focus_widget = 0; q->setFocus(Qt::OtherFocusReason); + } else if (focus_child) { + // if we are shown and there is an explicit focus child widget + // set, respect it by giving him focus. + focus_child->setFocus(Qt::OtherFocusReason); } // Process events when showing a Qt::SplashScreen widget before the event loop |