QTfrontend/ui/widget/drawmapwidget.cpp
changeset 6934 14a230552c2e
parent 6873 30840365af0a
child 6935 472ed92c4173
--- a/QTfrontend/ui/widget/drawmapwidget.cpp	Thu Apr 26 09:48:52 2012 +0200
+++ b/QTfrontend/ui/widget/drawmapwidget.cpp	Fri Apr 27 00:43:48 2012 +0400
@@ -19,6 +19,7 @@
 #include <QFile>
 #include <QMessageBox>
 #include <QEvent>
+#include <QDebug>
 
 #include "drawmapwidget.h"
 
@@ -51,8 +52,9 @@
 
 void DrawMapWidget::setScene(DrawMapScene * scene)
 {
+    m_scene = scene;
+
     ui->graphicsView->setScene(scene);
-    m_scene = scene;
 }
 
 void DrawMapWidget::resizeEvent(QResizeEvent * event)
@@ -110,3 +112,48 @@
             m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
     }
 }
+
+
+
+DrawMapView::DrawMapView(QWidget *parent) :
+    QGraphicsView(parent)
+{
+   setMouseTracking(true);
+
+    m_scene = 0;
+}
+
+
+DrawMapView::~DrawMapView()
+{
+
+}
+
+void DrawMapView::setScene(DrawMapScene *scene)
+{
+    m_scene = scene;
+
+    QGraphicsView::setScene(scene);
+}
+
+// Why don't I ever recieve this event?
+void DrawMapView::enterEvent(QEvent *event)
+{
+    if(m_scene)
+        m_scene->showCursor();
+
+    QGraphicsView::enterEvent(event);
+}
+
+void DrawMapView::leaveEvent(QEvent *event)
+{
+    if(m_scene)
+        m_scene->hideCursor();
+
+    QGraphicsView::leaveEvent(event);
+}
+
+bool DrawMapView::viewportEvent(QEvent *event)
+{
+    return QGraphicsView::viewportEvent(event);
+}