summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Verebelyi <vviktor2@gmail.com>2021-06-22 02:06:46 +0100
committerViktor Verebelyi <vviktor2@gmail.com>2021-06-22 02:06:46 +0100
commit72f05b2f9fb063c121993d7116480c4bda5e3705 (patch)
treeca8d77e886644f34f2a3ae0dc2d1e285d321da7b
parent211024517532fc6b2244ea81466c39a2cd96db1a (diff)
downloadnavit-72f05b2f9fb063c121993d7116480c4bda5e3705.tar.gz
Fix map jumping when dragging
-rw-r--r--navit/graphics/qt5/QNavitQuick_2.cpp9
-rw-r--r--navit/graphics/qt5/QNavitQuick_2.h2
-rw-r--r--navit/graphics/qt5/graphics_qt5.cpp20
3 files changed, 8 insertions, 23 deletions
diff --git a/navit/graphics/qt5/QNavitQuick_2.cpp b/navit/graphics/qt5/QNavitQuick_2.cpp
index 53b237bdf..7ed14ddce 100644
--- a/navit/graphics/qt5/QNavitQuick_2.cpp
+++ b/navit/graphics/qt5/QNavitQuick_2.cpp
@@ -158,8 +158,6 @@ void QNavitQuick_2::mousePressEvent(QMouseEvent* event) {
void QNavitQuick_2::mouseReleaseEvent(QMouseEvent* event) {
if(event->button() == Qt::LeftButton){
mapMove(m_originX, m_originY, event->x(), event->y());
- m_moveX = 0;
- m_moveY = 0;
}
}
@@ -197,6 +195,11 @@ void QNavitQuick_2::wheelEvent(QWheelEvent* event) {
}
}
+void QNavitQuick_2::draw(){
+ m_moveX = 0;
+ m_moveY = 0;
+ update();
+}
void QNavitQuick_2::mapMove(int originX, int originY, int destinationX, int destinationY) {
struct point *origin = new struct point;
origin->x = originX;
@@ -290,7 +293,7 @@ void QNavitQuick_2::setNavitInstance(NavitInstance *navit){
if(m_navitInstance) {
graphics_priv = navit->m_graphics_priv;
- QObject::connect(navit, SIGNAL(update()), this, SLOT(update()));
+ QObject::connect(navit, SIGNAL(update()), this, SLOT(draw()));
navit_add_callback(m_navitInstance->getNavit(),callback_new_attr_1(callback_cast(QNavitQuick_2::attributeCallbackHandler),
attr_orientation,this));
diff --git a/navit/graphics/qt5/QNavitQuick_2.h b/navit/graphics/qt5/QNavitQuick_2.h
index e24c5cdb5..d0af1f5cc 100644
--- a/navit/graphics/qt5/QNavitQuick_2.h
+++ b/navit/graphics/qt5/QNavitQuick_2.h
@@ -102,6 +102,8 @@ private:
int m_originY;
void updateZoomLevel();
+private slots:
+ void draw();
signals:
void leftButtonClicked(QPoint position);
void rightButtonClicked(QPoint position);
diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp
index 37a5a9760..59ab47c0b 100644
--- a/navit/graphics/qt5/graphics_qt5.cpp
+++ b/navit/graphics/qt5/graphics_qt5.cpp
@@ -627,16 +627,6 @@ static void draw_drag(struct graphics_priv* gr, struct point* p) {
#endif
gr->x = vector.x;
gr->y = vector.y;
-#if USE_QWIDGET
- /* call repaint on widget for stale area. */
- if (gr->widget != NULL)
- gr->widget->repaint(damage_x, damage_y, damage_w, damage_h);
-#endif
-#if USE_QML
- // No need to emit update, as QNavitQuic always repaints everything.
- // if (gr->navitInstance != NULL)
- // gr->navitInstance->emit_update();
-#endif
}
}
@@ -819,16 +809,6 @@ static void get_text_bbox(struct graphics_priv* gr, struct graphics_font_priv* f
static void overlay_disable(struct graphics_priv* gr, int disable) {
//dbg(lvl_error,"enter gr=%p, %d", gr, disable);
gr->disable = disable;
-#if USE_QWIDGET
- /* call repaint on widget */
- if (gr->widget != NULL)
- gr->widget->repaint(gr->x, gr->y, gr->pixmap->width(), gr->pixmap->height());
-#endif
-#if USE_QML
- if (gr->navitInstance != NULL)
- gr->navitInstance->emit_update();
-
-#endif
}
static void overlay_resize(struct graphics_priv* gr, struct point* p, int w, int h, int wraparound) {