author | nemo |
Sun, 21 Aug 2011 11:24:20 -0400 | |
changeset 5622 | 93e97d3a2c10 |
parent 4976 | 088d40d8aba2 |
child 5858 | 1f4a8cf9efcb |
permissions | -rw-r--r-- |
4976 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2011 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
4423 | 19 |
#ifndef DRAWMAPSCENE_H |
20 |
#define DRAWMAPSCENE_H |
|
21 |
||
22 |
#include <QGraphicsScene> |
|
4442 | 23 |
#include <QPainterPath> |
4423 | 24 |
|
4426 | 25 |
class QGraphicsPathItem; |
26 |
||
4427 | 27 |
typedef QList<QList<QPoint> > Paths; |
28 |
||
4423 | 29 |
class DrawMapScene : public QGraphicsScene |
30 |
{ |
|
31 |
Q_OBJECT |
|
32 |
public: |
|
33 |
explicit DrawMapScene(QObject *parent = 0); |
|
34 |
||
4427 | 35 |
QByteArray encode(); |
4442 | 36 |
void decode(QByteArray data); |
4427 | 37 |
|
4423 | 38 |
signals: |
4427 | 39 |
void pathChanged(); |
4423 | 40 |
|
41 |
public slots: |
|
4426 | 42 |
void undo(); |
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4520
diff
changeset
|
43 |
void clearMap(); |
4439 | 44 |
void simplifyLast(); |
4423 | 45 |
|
46 |
private: |
|
4424 | 47 |
QPen m_pen; |
48 |
QBrush m_brush; |
|
4426 | 49 |
QGraphicsPathItem * m_currPath; |
4427 | 50 |
Paths paths; |
4424 | 51 |
|
4423 | 52 |
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent); |
53 |
virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent); |
|
54 |
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent); |
|
4442 | 55 |
|
56 |
QPainterPath pointsToPath(const QList<QPoint> points); |
|
4423 | 57 |
}; |
58 |
||
59 |
#endif // DRAWMAPSCENE_H |