Merge branch 'map' of https://vcs.maemo.org/git/situare into map
[situare] / src / map / mapview.cpp
index f07a4df..7533ed8 100644 (file)
     #include <QGLWidget>
 #endif // Q_WS_MAEMO_5
 
-#include "common.h"
+#include "mapcommon.h"
 #include "mapview.h"
 
 MapView::MapView(QWidget *parent) : QGraphicsView(parent)
 {
+/**
+  * Use OpenGL for desktop to gain some performance in map view.
+  * OpenGL can't be used in scratchbox.
+  */
 #ifndef Q_WS_MAEMO_5
-    // use opengl for desktop to gain some performance in map view
-    // opengl can't be used in scrathbox
-    setViewport(new QGLWidget);
-    this->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
-#endif // Q_WS_MAEMO_5
+    //setViewport(new QGLWidget);
+#endif // !Q_WS_MAEMO_5
 
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -85,29 +86,29 @@ qreal MapView::currentScale()
 
 void MapView::mouseMoveEvent(QMouseEvent *event)
 {
-    m_scenePosition += m_mousePosition - mapToScene(event->pos());
+    m_scenePosition += m_mousePosition - mapToScene(event->pos()).toPoint();
 
     emit viewScrolled(m_scenePosition);
     //qDebug() << __PRETTY_FUNCTION__ << "m_scenePosition" << m_scenePosition;
 
-    m_mousePosition = mapToScene(event->pos());
+    m_mousePosition = mapToScene(event->pos()).toPoint();
 }
 
 void MapView::mousePressEvent(QMouseEvent *event)
 {
-    m_mousePosition = mapToScene(event->pos());
-    m_scenePosition = mapToScene(width() / 2 - 1, height() / 2 - 1);
+    m_mousePosition = mapToScene(event->pos()).toPoint();
+    m_scenePosition = mapToScene(width() / 2 - 1, height() / 2 - 1).toPoint();
 }
 
 
-void MapView::centerToSceneCoordinates(QPointF sceneCoordinate)
+void MapView::centerToSceneCoordinates(QPoint sceneCoordinate)
 {
-    //qDebug() << __PRETTY_FUNCTION__ << "sceneCoordinate" << sceneCoordinate;
+//    qDebug() << __PRETTY_FUNCTION__ << "sceneCoordinate" << sceneCoordinate;
     centerOn(sceneCoordinate);
 }
 
 void MapView::resizeEvent(QResizeEvent *event)
 {
-    qDebug() << "Resize event: " << event->size();
+    //qDebug() << "Resize event: " << event->size();
     emit viewResized(event->size());
 }