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>bb10
parent
3ddc3c78ce
commit
11214f4c42
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue