Don't handle window events after Qt::WA_DontShowOnScreen is set

QWidget can set WA_DontShowOnScreen while visible, which generates
events when the QWidgetWindow is hidden. This causes
QWidgetWindow::handleExposeEvent() to clear the WA_Mapped flag which was
set by QWidgetPrivate::show_sys(). Once WA_Mapped is cleared, the
QWidget becomes non-functional, causing failures in at least
tst_QGraphicsProxyWidget::paintEvent(), since paint events are not sent
to widgets that don't have WA_Mapped set.

Change-Id: I2d3e5b3baffb07ab73f41520771866f181260bd2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Bradley T. Hughes 2012-05-08 07:37:04 +02:00 committed by Qt by Nokia
parent 4e4403d69c
commit cebfd69ade

View File

@ -83,6 +83,12 @@ QObject *QWidgetWindow::focusObject() const
bool QWidgetWindow::event(QEvent *event)
{
if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) {
// \a event is uninteresting for QWidgetWindow, the event was probably
// generated before WA_DontShowOnScreen was set
return m_widget->event(event);
}
switch (event->type()) {
case QEvent::Close:
handleCloseEvent(static_cast<QCloseEvent *>(event));