diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2017-04-20 16:07:06 +0200 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2017-04-22 15:18:01 +0000 |
commit | 41eefd7493bf0119a4fd1a069e31ab4f2c4d10f9 (patch) | |
tree | b9f8c363961d27939894c63d7d065ad247779656 /tests/benchmarks | |
parent | d4cdc4542609e61d04802902d73c693faa8d8969 (diff) |
Deprecate QCoreApplication::flush()
... as it has outlived its original purpose:
Qt3 implementation on X11:
void QApplication::flush() { flushX(); }
void QApplication::flushX() { if (appDpy) XFlush( appDpy ); }
Qt4 implementation on X11:
Did nothing when QApplication::flush() was called (the flush()
overrides in {unix,glib} event dispatchers with empty bodies).
In Qt5 this function somehow has been repurposed (inconsistently)
to do what QCoreApplication::sendPostedEvents already does:
QAbstractEventDispatcher::flush() = 0;
=> QCocoaEventDispatcher::flush() {}
=> QEventDispatcherCoreFoundation::flush() {}
=> QIOSEventDispatcher (does not override ::flush())
=> QEventDispatcherGlib::flush() {}
=> QPAEventDispatcherGlib (does not override ::flush())
=> QEventDispatcherUNIX::flush() {}
=> QUnixEventDispatcherQPA (when QT_NO_GLIB=true)
::flush() { if (qApp) qApp->sendPostedEvents(); })
==> QAndroidEventDispatcher (does not override ::flush())
=> QEventDispatcherWin32::flush() {}
=> QOffscreenEventDispatcher::flush() {
if (qApp) qApp->sendPostedEvents();
QEventDispatcherWin32::flush();
}
=> QWindowsGuiEventDispatcher (does not override ::flush())
=> QWindowsDirect2DEventDispatcher (does not override ::flush())
=> QEventDispatcherWinRT::flush() {}
=> QOffscreenEventDispatcher::flush() {
if (qApp) qApp->sendPostedEvents();
QEventDispatcherWinRT::flush();
}
=> QWinRTEventDispatcher (qminimaleglintegration.cpp) (does not override ::flush())
=> QWinRTEventDispatcher (qwinrteventdispatcher.h) (does not override ::flush())
Whatever this function was doing on macOS in Qt3 and Qt4 also has been
dropped in Qt5. It appears that the other event dispatchers in Qt5 that
have overrides for flush() have simply copy-pasted this logic.
Clearly the documentation of QCoreApplication::flush() is outdated and
has nothing to do with the actual implementation in Qt5.
This function is rarely used in Qt5 sources. It should be safe to remove
the calls to QCoreApplication::flush() from Qt source code, as this
function has been doing nothing on most platforms anyways. Repurposing
it even broke handling of posted events (see QTBUG-48717).
[ChangeLog][QtCore][Event loop] QCoreApplication::flush() is now
deprecated. Use QCoreApplication::processEvents() and
QCoreApplication::sendPostedEvents() instead.
Task-number: QTBUG-33489
Task-number: QTBUG-48717
Change-Id: Icc7347ff203024b7153ea74be6bf527dd07ce821
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'tests/benchmarks')
5 files changed, 2 insertions, 7 deletions
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 88779e8471..313cc56b0b 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -69,14 +69,13 @@ tst_QGraphicsItem::~tst_QGraphicsItem() static inline void processEvents() { - QApplication::flush(); QApplication::processEvents(); QApplication::processEvents(); } void tst_QGraphicsItem::initTestCase() { - QApplication::flush(); + processEvents(); QTest::qWait(1500); processEvents(); } diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 8189388d0f..622df2fb3b 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -62,7 +62,6 @@ tst_QGraphicsScene::~tst_QGraphicsScene() static inline void processEvents() { - QApplication::flush(); QApplication::processEvents(); QApplication::processEvents(); } diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 0064ecbaaf..cdec833f4e 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -44,7 +44,6 @@ static inline void processEvents() { QPixmapCache::clear(); - QApplication::flush(); QApplication::processEvents(); QApplication::processEvents(); } diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp index 19b8e27b63..aeec0624e8 100644 --- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp +++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp @@ -33,7 +33,6 @@ static void processEvents() { - QApplication::flush(); QApplication::processEvents(); QApplication::processEvents(); } @@ -174,7 +173,7 @@ void tst_QWidget::update() } } - QApplication::flush(); + QApplication::processEvents(); } void tst_QWidget::updatePartial_data() diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp index b8d5478c03..c1e6d780ba 100644 --- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp @@ -169,7 +169,6 @@ void tst_qstylesheetstyle::grid() if(show) { w->show(); QTest::qWaitForWindowExposed(w); - QApplication::flush(); QApplication::processEvents(); QTest::qWait(30); QApplication::processEvents(); |