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:
-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()