summaryrefslogtreecommitdiff
path: root/platform/qt/src/timer_impl.hpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-09-01 14:05:59 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-04-20 20:55:51 +0300
commite93d51c922a0d55b6f40b07185452dc54151736d (patch)
tree0042be118f388dfdbe590b06cf2c4efe4ef1b1cf /platform/qt/src/timer_impl.hpp
parent2af3863b5716b290c852e2dae93ca023cb6bf0f4 (diff)
downloadqtlocation-mapboxgl-e93d51c922a0d55b6f40b07185452dc54151736d.tar.gz
[Qt] Implement the AsyncTask, Timer and RunLoop using Qt
Now Mapbox GL will handle events using Qt as backend instead of libuv.
Diffstat (limited to 'platform/qt/src/timer_impl.hpp')
-rw-r--r--platform/qt/src/timer_impl.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/platform/qt/src/timer_impl.hpp b/platform/qt/src/timer_impl.hpp
new file mode 100644
index 0000000000..a54abfd8b5
--- /dev/null
+++ b/platform/qt/src/timer_impl.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <mbgl/util/timer.hpp>
+
+#include <QObject>
+#include <QTimer>
+
+namespace mbgl {
+namespace util {
+
+class Timer::Impl : public QObject {
+ Q_OBJECT
+
+public:
+ Impl();
+
+ void start(uint64_t timeout, uint64_t repeat, std::function<void ()>&& cb);
+ void stop();
+
+public slots:
+ void timerFired();
+
+private:
+ uint64_t repeat;
+ std::function<void()> callback;
+
+ QTimer timer;
+};
+
+}
+}