00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <Qt>
00014 #include <QtGui>
00015 #include <QtDebug>
00016 #include <QGraphicsScene>
00017 #include <QGraphicsSceneMouseEvent>
00018 #include <QGraphicsSceneDragDropEvent>
00019 #include <QPixmap>
00020
00021 #include "mapscene.h"
00022
00023 MapScene::MapScene()
00024 {
00025
00026 }
00027
00028 MapScene::~MapScene()
00029 {
00030
00031 }
00032
00033 void MapScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
00034 {
00035
00036
00037
00038
00039 update();
00040 emit mapScenePressEvent(event->scenePos());
00041 }
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 void MapScene::dropEvent ( QGraphicsSceneDragDropEvent *event )
00052 {
00053
00054 qreal x = event->scenePos().x();
00055 qreal y = event->scenePos().y();
00056 emit messagemap( QString("Mouse DROP Position at [ %1 , %2 ]").arg(x).arg(y) );
00057 emit ungrabRobot();
00058
00059 update();
00060 }
00061
00062 void MapScene::dragMoveEvent ( QGraphicsSceneDragDropEvent *event )
00063 {
00064
00065
00066
00067 qreal x = event->scenePos().x();
00068 qreal y = event->scenePos().y();
00069 emit messagemap( QString("Robot ( over map ) Position at [ %1 , %2 ]").arg(x).arg(y) );
00070 emit changeRobot( QPoint(x,y) );
00071 update();
00072
00073 }
00074
00075