tools/drawMapTest/drawmapscene.h
branchui-scaling
changeset 15283 c4fd2813b127
parent 13390 0135e64c6c66
parent 15279 7ab5cf405686
child 15663 d92eeb468dad
equal deleted inserted replaced
13390:0135e64c6c66 15283:c4fd2813b127
     1 #ifndef DRAWMAPSCENE_H
       
     2 #define DRAWMAPSCENE_H
       
     3 
       
     4 #include <QGraphicsScene>
       
     5 #include <QPainterPath>
       
     6 
       
     7 class QGraphicsPathItem;
       
     8 
       
     9 typedef QList<QList<QPoint> > Paths;
       
    10 
       
    11 class DrawMapScene : public QGraphicsScene
       
    12 {
       
    13 Q_OBJECT
       
    14 public:
       
    15     explicit DrawMapScene(QObject *parent = 0);
       
    16 
       
    17     QByteArray encode();
       
    18     void decode(QByteArray data);
       
    19 
       
    20 signals:
       
    21     void pathChanged();
       
    22 
       
    23 public slots:
       
    24     void undo();
       
    25     void simplifyLast();
       
    26 
       
    27 private:
       
    28     QPen m_pen;
       
    29     QBrush m_brush;
       
    30     QGraphicsPathItem  * m_currPath;
       
    31     Paths paths;
       
    32 
       
    33     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
       
    34     virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
       
    35     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
       
    36 
       
    37     QPainterPath pointsToPath(const QList<QPoint> points);
       
    38 };
       
    39 
       
    40 #endif // DRAWMAPSCENE_H