diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 0729c7b74e..61956b3fa4 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6595,11 +6595,6 @@ void QWidget::setFocus(Qt::FocusReason reason) } else { f->d_func()->updateFocusChild(); } - - if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) { - if (extra->window) - emit extra->window->focusObjectChanged(f); - } } void QWidgetPrivate::setFocus_sys() @@ -6634,6 +6629,11 @@ void QWidgetPrivate::updateFocusChild() w = w->isWindow() ? 0 : w->parentWidget(); } } + + if (QTLWExtra *extra = q->window()->d_func()->maybeTopData()) { + if (extra->window) + emit extra->window->focusObjectChanged(q); + } } /*! @@ -6675,9 +6675,15 @@ void QWidget::clearFocus() w->d_func()->focus_child = 0; w = w->parentWidget(); } - // Since focus_child is the basis for the top level QWidgetWindow's focusObject() - // we need to report this change to the rest of Qt, but we match setFocus() and - // do it at the end of the function. + + // Since we've unconditionally cleared the focus_child of our parents, we need + // to report this to the rest of Qt. Note that the focus_child is not the same + // thing as the application's focusWidget, which is why this piece of code is + // not inside the hasFocus() block below. + if (QTLWExtra *extra = window()->d_func()->maybeTopData()) { + if (extra->window) + emit extra->window->focusObjectChanged(extra->window->focusObject()); + } #ifndef QT_NO_GRAPHICSVIEW QWExtra *topData = d_func()->extra; @@ -6700,15 +6706,6 @@ void QWidget::clearFocus() #endif } } - - // Since we've unconditionally cleared the focus_child of our parents, we need - // to report this to the rest of Qt. Note that the focus_child is not the same - // thing as the application's focusWidget, which is why this piece of code is - // not inside the hasFocus() block above. - if (QTLWExtra *extra = window()->d_func()->maybeTopData()) { - if (extra->window) - emit extra->window->focusObjectChanged(extra->window->focusObject()); - } } |