diff options
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 18 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 91302d9e62..3ab477ccfb 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3161,9 +3161,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::KeyRelease: { bool isWidget = receiver->isWidgetType(); - bool isGraphicsWidget = false; #ifndef QT_NO_GRAPHICSVIEW - isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver); + const bool isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver); #endif QKeyEvent* key = static_cast<QKeyEvent*>(e); bool def = key->isAccepted(); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5bff30524a..58bda5cfb2 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6415,13 +6415,13 @@ bool QWidget::hasFocus() const const QWidget* w = this; while (w->d_func()->extra && w->d_func()->extra->focus_proxy) w = w->d_func()->extra->focus_proxy; - if (QWidget *window = w->window()) { #ifndef QT_NO_GRAPHICSVIEW + if (QWidget *window = w->window()) { QWExtra *e = window->d_func()->extra; if (e && e->proxyWidget && e->proxyWidget->hasFocus() && window->focusWidget() == w) return true; -#endif } +#endif // !QT_NO_GRAPHICSVIEW return (QApplication::focusWidget() == w); } @@ -7918,8 +7918,11 @@ void QWidgetPrivate::show_sys() invalidateBuffer(q->rect()); q->setAttribute(Qt::WA_Mapped); // add our window the modal window list (native dialogs) - if ((q->isWindow() && (!extra || !extra->proxyWidget)) - && q->windowModality() != Qt::NonModal && window) { + if (window && q->isWindow() +#ifndef QT_NO_GRAPHICSVIEW + && (!extra || !extra->proxyWidget) +#endif + && q->windowModality() != Qt::NonModal) { QGuiApplicationPrivate::showModalWindow(window); } return; @@ -8053,8 +8056,11 @@ void QWidgetPrivate::hide_sys() if (q->testAttribute(Qt::WA_DontShowOnScreen)) { q->setAttribute(Qt::WA_Mapped, false); // remove our window from the modal window list (native dialogs) - if ((q->isWindow() && (!extra || !extra->proxyWidget)) - && q->windowModality() != Qt::NonModal && window) { + if (window && q->isWindow() +#ifndef QT_NO_GRAPHICSVIEW + && (!extra || !extra->proxyWidget) +#endif + && q->windowModality() != Qt::NonModal) { QGuiApplicationPrivate::hideModalWindow(window); } // do not return here, if window non-zero, we must hide it |