diff options
Diffstat (limited to 'async/autotests/testkjob.cpp')
-rw-r--r-- | async/autotests/testkjob.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/async/autotests/testkjob.cpp b/async/autotests/testkjob.cpp new file mode 100644 index 0000000..b86f913 --- /dev/null +++ b/async/autotests/testkjob.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "testkjob.h" | ||
2 | |||
3 | TestKJob::TestKJob(int result) | ||
4 | : mResult(result) | ||
5 | { | ||
6 | connect(&mTimer, &QTimer::timeout, | ||
7 | this, &TestKJob::onTimeout); | ||
8 | mTimer.setSingleShot(true); | ||
9 | mTimer.setInterval(200); | ||
10 | } | ||
11 | |||
12 | TestKJob::~TestKJob() | ||
13 | {} | ||
14 | |||
15 | void TestKJob::start() | ||
16 | { | ||
17 | mTimer.start(); | ||
18 | } | ||
19 | |||
20 | int TestKJob::result() | ||
21 | { | ||
22 | return mResult; | ||
23 | } | ||
24 | |||
25 | void TestKJob::onTimeout() | ||
26 | { | ||
27 | emitResult(); | ||
28 | } \ No newline at end of file | ||