diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-04-22 13:21:28 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2017-04-29 08:24:24 +0000 |
commit | 9d918495ee56dca5826070df888d20adfcc29641 (patch) | |
tree | f747852109c01af142ca8fe2e100c13a0c690247 /tests/auto/corelib/kernel/qtimer | |
parent | a6c091c2d18f6e7f849da7dfa3bd1971017fca73 (diff) |
Add a few std::move in functions accepting slots
This allows the use of move-only function objects
Task-number: QTBUG-60339
Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qtimer')
-rw-r--r-- | tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 3c2989831e..bcae39af3d 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -834,7 +834,6 @@ void tst_QTimer::singleShotToFunctors() QTest::qWait(800); QCOMPARE(count, 2); -#if defined(Q_COMPILER_LAMBDA) QTimer::singleShot(0, [&count] { ++count; }); QCoreApplication::processEvents(); QCOMPARE(count, 3); @@ -853,7 +852,15 @@ void tst_QTimer::singleShotToFunctors() thread.quit(); thread.wait(); -#endif + + struct MoveOnly : CountedStruct { + Q_DISABLE_COPY(MoveOnly); + MoveOnly(MoveOnly &&o) : CountedStruct(std::move(o)) {}; + MoveOnly(int *c) : CountedStruct(c) {} + }; + QTimer::singleShot(0, MoveOnly(&count)); + QCoreApplication::processEvents(); + QCOMPARE(count, 5); _e.reset(); _t = Q_NULLPTR; |