diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-09-07 15:07:27 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-09-13 12:51:33 +0200 |
commit | 11214f4c428497a594e17972bc566d1445b681c6 (patch) | |
tree | 5a525fef5e1e7a1f503c09194194f3db540e5357 /src | |
parent | 3ddc3c78ce7e4df1a7125292c4c3ad329f061926 (diff) |
Don't exclude WA_DontShowOnScreen widgets for QWidgetWindow event processing
The Qt::WA_DontShowOnScreen widget attribute does not limit whether a
widget will be created (have a QWindow and corresponding QPlatformWindow).
It only limits whether the widget will be shown.
As a result, we need to respect and process incoming events on a QWindow
level, just as any other window. Any considerations that may apply because
of WA_DontShowOnScreen should happen further down in the event delivery.
For example for the issue in 74aae00a4e8e70845e8092abbefa7830c386e66b,
where QWidgetWindow::handleExposeEvent() cleared the WA_Mapped flag which
was set by QWidgetPrivate::show_sys().
Change-Id: I187ebe14ea84538a3715f1d09fb1ba1ce93fcc82
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 5ca26a39cb..80e9b1ab5c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -236,14 +236,6 @@ bool QWidgetWindow::event(QEvent *event) if (!m_widget) return QWindow::event(event); - if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) { - // \a event is uninteresting for QWidgetWindow, the event was probably - // generated before WA_DontShowOnScreen was set - if (!shouldBePropagatedToWidget(event)) - return true; - return QCoreApplication::forwardEvent(m_widget, event); - } - switch (event->type()) { case QEvent::Close: { // The widget might be deleted in the close event handler. @@ -723,6 +715,9 @@ bool QWidgetWindow::updateSize() bool changed = false; if (m_widget->testAttribute(Qt::WA_OutsideWSRange)) return changed; + if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) + return changed; + if (m_widget->data->crect.size() != geometry().size()) { changed = true; m_widget->data->crect.setSize(geometry().size()); @@ -798,6 +793,8 @@ void QWidgetWindow::handleMoveEvent(QMoveEvent *event) { if (m_widget->testAttribute(Qt::WA_OutsideWSRange)) return; + if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) + return; auto oldPosition = m_widget->data->crect.topLeft(); auto newPosition = geometry().topLeft(); @@ -983,6 +980,9 @@ void QWidgetWindow::handleDropEvent(QDropEvent *event) void QWidgetWindow::handleExposeEvent(QExposeEvent *event) { + if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) + return; // Ignore for widgets that fake exposure + QWidgetPrivate *wPriv = m_widget->d_func(); const bool exposed = isExposed(); |