summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-05 13:38:44 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-05 14:38:57 (GMT)
commitff9497f82d605688453e2f027bab7c719048f0d2 (patch)
tree78bcc7aab46aba17460fa698e88ccc548ba19864 /src/gui/kernel
parent0302c0103da731b7af8d749b1643c50e39d81c00 (diff)
downloadQt-ff9497f82d605688453e2f027bab7c719048f0d2.zip
Qt-ff9497f82d605688453e2f027bab7c719048f0d2.tar.gz
Qt-ff9497f82d605688453e2f027bab7c719048f0d2.tar.bz2
Revert two of my commits, restoring the original fix for focus handling.
The fix that was introduced adds regressions, and I don't see a way we can fix it without breaking someone elses code. So restoring the original fix that just avoid a crash (autotest by Thierry is included). Revert "Revert Avoid a crash when setting a focus in a widget hierarchy containing" Revert "Setting a focus on a widget hierarchy which contains both visible and invisible widgets could cause a crash." This reverts commit be833a4f25a8ec8c3dd7a8ac4fa4b0507c93e7ee. This partially reverts commit 1a7da7096bbda17197738061902f4489af234bc0 Reviewed-by: Thierry Bastian Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwidget.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index d436ffb..6026821 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5674,15 +5674,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
w = w->isWindow() ? 0 : w->parentWidget();
}
} else {
- while (w && w->isVisible()) {
+ while (w) {
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
@@ -5757,8 +5752,9 @@ void QWidget::setFocus(Qt::FocusReason reason)
void QWidget::clearFocus()
{
QWidget *w = this;
- while (w && w->d_func()->focus_child == this) {
- w->d_func()->focus_child = 0;
+ while (w) {
+ if (w->d_func()->focus_child == this)
+ w->d_func()->focus_child = 0;
w = w->parentWidget();
}
#ifndef QT_NO_GRAPHICSVIEW
@@ -6734,10 +6730,6 @@ 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