author | koda |
Sat, 19 Feb 2011 04:04:34 +0100 | |
changeset 4952 | df752b69a142 |
parent 4560 | 5d6c7f88db73 |
child 4976 | 088d40d8aba2 |
permissions | -rw-r--r-- |
4423 | 1 |
#ifndef DRAWMAPSCENE_H |
2 |
#define DRAWMAPSCENE_H |
|
3 |
||
4 |
#include <QGraphicsScene> |
|
4442 | 5 |
#include <QPainterPath> |
4423 | 6 |
|
4426 | 7 |
class QGraphicsPathItem; |
8 |
||
4427 | 9 |
typedef QList<QList<QPoint> > Paths; |
10 |
||
4423 | 11 |
class DrawMapScene : public QGraphicsScene |
12 |
{ |
|
13 |
Q_OBJECT |
|
14 |
public: |
|
15 |
explicit DrawMapScene(QObject *parent = 0); |
|
16 |
||
4427 | 17 |
QByteArray encode(); |
4442 | 18 |
void decode(QByteArray data); |
4427 | 19 |
|
4423 | 20 |
signals: |
4427 | 21 |
void pathChanged(); |
4423 | 22 |
|
23 |
public slots: |
|
4426 | 24 |
void undo(); |
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4520
diff
changeset
|
25 |
void clearMap(); |
4439 | 26 |
void simplifyLast(); |
4423 | 27 |
|
28 |
private: |
|
4424 | 29 |
QPen m_pen; |
30 |
QBrush m_brush; |
|
4426 | 31 |
QGraphicsPathItem * m_currPath; |
4427 | 32 |
Paths paths; |
4424 | 33 |
|
4423 | 34 |
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent); |
35 |
virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent); |
|
36 |
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent); |
|
4442 | 37 |
|
38 |
QPainterPath pointsToPath(const QList<QPoint> points); |
|
4423 | 39 |
}; |
40 |
||
41 |
#endif // DRAWMAPSCENE_H |