diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-04-03 11:16:42 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-05 16:02:45 +0200 |
commit | 6dc8f47bb05a8acb3cbcc697e0dc05356a01d4cf (patch) | |
tree | 81c7ebe9b3a55f2c8c4cdbc2fe6115024d145435 /tests/auto/quick/shared/viewtestutil.cpp | |
parent | c87ae78dd78f4a8cee040b5d27e7a6f2425f3aaf (diff) |
Compress touch events in QQuickWindow.
Instead of sending multiple touch updates per frame, we
store the last one and flush the pending events just before
we enter into the scene graph sync phase.
[ChangeLog][QtQuick] QQuickWindow will compresses touch events
and delivers at most one touch event per frame.
Done-with: Robin Burchell <robin.burchell@jollamobile.com>
Change-Id: Ia0169bc4a3f0da67709b91ca65c326934b55d372
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/quick/shared/viewtestutil.cpp')
-rw-r--r-- | tests/auto/quick/shared/viewtestutil.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp index 0e3964d52d..aa6d7c4a93 100644 --- a/tests/auto/quick/shared/viewtestutil.cpp +++ b/tests/auto/quick/shared/viewtestutil.cpp @@ -47,6 +47,9 @@ #include <QtTest/QTest> +#include <private/qquickwindow_p.h> + + QQuickView *QQuickViewTestUtil::createView() { QQuickView *window = new QQuickView(0); @@ -341,3 +344,23 @@ QList<QPair<QString,QString> > QQuickViewTestUtil::ListRange::getModelDataValues return data; } +namespace QQuickTouchUtils { + + /* QQuickWindow does event compression and only delivers events just + * before it is about to render the next frame. Since some tests + * rely on events being delivered immediately AND that no other + * event processing has occurred in the meanwhile, we flush the + * event manually and immediately. + */ + void flush(QQuickWindow *window) { + if (!window) + return; + QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window); + if (!wd || !wd->delayedTouch) + return; + wd->reallyDeliverTouchEvent(wd->delayedTouch); + delete wd->delayedTouch; + wd->delayedTouch = 0; + } + +} |