diff options
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 451686f..d436ffb 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5757,9 +5757,8 @@ void QWidget::setFocus(Qt::FocusReason reason) void QWidget::clearFocus() { QWidget *w = this; - while (w) { - if (w->d_func()->focus_child == this) - w->d_func()->focus_child = 0; + while (w && w->d_func()->focus_child == this) { + w->d_func()->focus_child = 0; w = w->parentWidget(); } #ifndef QT_NO_GRAPHICSVIEW |