Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <ExMix@Youris-MacBook-Pro.local>2013-05-23 16:26:57 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:55:49 +0300
commita14b4e3d4dec804ec9989ca168ad3a6683f2e5ba (patch)
tree4b660c4fe66f59a73a44d51bf761b6f3c1ea451e /qt_tstfrm
parentb55299a759aa20fd3057bd970016ac717308808a (diff)
Looped drawing in tests
Diffstat (limited to 'qt_tstfrm')
-rw-r--r--qt_tstfrm/gui_test_widget.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/qt_tstfrm/gui_test_widget.hpp b/qt_tstfrm/gui_test_widget.hpp
index 3e1ffb6747..f595202fa0 100644
--- a/qt_tstfrm/gui_test_widget.hpp
+++ b/qt_tstfrm/gui_test_widget.hpp
@@ -4,6 +4,8 @@
#include "../../gui/controller.hpp"
#include "../../base/strings_bundle.hpp"
#include <QMouseEvent>
+#include <QObject>
+#include <QTimerEvent>
template <class T, void (T::*)(gui::Controller*)>
struct init_with_controller_fn_bind
@@ -34,6 +36,9 @@ private:
shared_ptr<graphics::Screen> m_cacheScreen;
shared_ptr<StringsBundle> m_stringBundle;
+ shared_ptr<QObject> m_timerObj;
+ int m_timerID;
+
public:
void invalidate()
@@ -43,6 +48,10 @@ public:
void initializeGL()
{
+ m_timerObj.reset(new QObject());
+ m_timerObj->installEventFilter(this);
+ m_timerID = m_timerObj->startTimer(1000 / 60);
+
base_t::initializeGL();
m_controller.reset(new gui::Controller());
@@ -113,6 +122,20 @@ public:
m_controller->OnTapMoved(m2::PointU(e->pos().x(), e->pos().y()));
}
+
+ bool eventFilter(QObject * obj, QEvent *event)
+ {
+ if (obj == m_timerObj.get() && event->type() == QEvent::Timer)
+ {
+ if (((QTimerEvent *)event)->timerId() == m_timerID)
+ {
+ invalidate();
+ return true;
+ }
+ }
+
+ return false;
+ }
};
template <class Test> QWidget * create_gui_test_widget()