From fa9728f19c8bf8ae925a1c99d056559b7bc84515 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 29 Jun 2018 09:15:51 +0200 Subject: [PATCH] Revert "QWidgetWindow: Immediately forward close events to QWindow" This reverts commit e0b5ff4ad583befbecbcbe462998e3ed80899531. References: kde#395988 References: QTBUG-43344 --- src/widgets/kernel/qwidgetwindow.cpp | 1 - .../widgets/kernel/qwidget/tst_qwidget.cpp | 28 ------------------- 2 files changed, 29 deletions(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 1f3057b008..24e0173ac1 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -237,7 +237,6 @@ bool QWidgetWindow::event(QEvent *event) switch (event->type()) { case QEvent::Close: handleCloseEvent(static_cast(event)); - QWindow::event(event); return true; case QEvent::Enter: diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 6a049aedf1..c7dab650fe 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -401,8 +401,6 @@ private slots: void tabletTracking(); - void closeEvent(); - private: bool ensureScreenSize(int width, int height); @@ -10800,31 +10798,5 @@ void tst_QWidget::tabletTracking() QTRY_COMPARE(widget.moveEventCount, 3); } -class CloseCountingWidget : public QWidget -{ -public: - int closeCount = 0; - void closeEvent(QCloseEvent *ev) override; -}; - -void CloseCountingWidget::closeEvent(QCloseEvent *ev) -{ - ++closeCount; - ev->accept(); -} - -void tst_QWidget::closeEvent() -{ - CloseCountingWidget widget; - widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(&widget)); - // Yes we call the close() function twice. This mimics the behavior of QTBUG-43344 where - // QApplication first closes all windows and then QCocoaApplication flushes window system - // events, triggering more close events. - widget.windowHandle()->close(); - widget.windowHandle()->close(); - QCOMPARE(widget.closeCount, 1); -} - QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- 2.17.1