QTfrontend/drawmapscene.h
changeset 6616 f77bb02b669f
parent 5858 1f4a8cf9efcb
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    26 
    26 
    27 typedef QList<QList<QPoint> > Paths;
    27 typedef QList<QList<QPoint> > Paths;
    28 
    28 
    29 class DrawMapScene : public QGraphicsScene
    29 class DrawMapScene : public QGraphicsScene
    30 {
    30 {
    31 Q_OBJECT
    31         Q_OBJECT
    32 public:
    32     public:
    33     explicit DrawMapScene(QObject *parent = 0);
    33         explicit DrawMapScene(QObject *parent = 0);
    34 
    34 
    35     QByteArray encode();
    35         QByteArray encode();
    36     void decode(QByteArray data);
    36         void decode(QByteArray data);
    37 
    37 
    38 signals:
    38     signals:
    39     void pathChanged();
    39         void pathChanged();
    40 
    40 
    41 public slots:
    41     public slots:
    42     void undo();
    42         void undo();
    43     void clearMap();
    43         void clearMap();
    44     void simplifyLast();
    44         void simplifyLast();
    45 
    45 
    46 private:
    46     private:
    47     QPen m_pen;
    47         QPen m_pen;
    48     QBrush m_brush;
    48         QBrush m_brush;
    49     QGraphicsPathItem  * m_currPath;
    49         QGraphicsPathItem  * m_currPath;
    50     Paths paths;
    50         Paths paths;
    51     Paths oldPaths;
    51         Paths oldPaths;
    52     QList<QGraphicsItem *> oldItems;
    52         QList<QGraphicsItem *> oldItems;
    53 
    53 
    54     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
    54         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
    55     virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
    55         virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
    56     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
    56         virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
    57 
    57 
    58     QPainterPath pointsToPath(const QList<QPoint> points);
    58         QPainterPath pointsToPath(const QList<QPoint> points);
    59 };
    59 };
    60 
    60 
    61 #endif // DRAWMAPSCENE_H
    61 #endif // DRAWMAPSCENE_H