File tree Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* **************************************************************************
2
+ qgsmaptoolemitpoint.cpp - map tool that emits a signal on click
3
+ ---------------------
4
+ begin : June 2007
5
+ copyright : (C) 2007 by Martin Dobias
6
+ email : wonder.sk at gmail dot com
7
+ ***************************************************************************
8
+ * *
9
+ * This program is free software; you can redistribute it and/or modify *
10
+ * it under the terms of the GNU General Public License as published by *
11
+ * the Free Software Foundation; either version 2 of the License, or *
12
+ * (at your option) any later version. *
13
+ * *
14
+ ***************************************************************************/
15
+ /* $Id$ */
16
+
17
+
18
+ #include " qgsmaptoolemitpoint.h"
19
+ #include " qgsmapcanvas.h"
20
+
21
+
22
+ QgsMapToolEmitPoint::QgsMapToolEmitPoint (QgsMapCanvas* canvas)
23
+ : QgsMapTool(canvas)
24
+ {
25
+ }
26
+
27
+ void QgsMapToolEmitPoint::canvasMoveEvent (QMouseEvent * e)
28
+ {
29
+ }
30
+
31
+ void QgsMapToolEmitPoint::canvasPressEvent (QMouseEvent * e)
32
+ {
33
+ QgsPoint pnt = toMapCoords (e->pos ());
34
+ emit gotPoint (pnt, e->button ());
35
+ }
36
+
37
+ void QgsMapToolEmitPoint::canvasReleaseEvent (QMouseEvent * e)
38
+ {
39
+ }
Original file line number Diff line number Diff line change
1
+ /* **************************************************************************
2
+ qgsmaptoolemitpoint.h - map tool that emits a signal on click
3
+ ---------------------
4
+ begin : June 2007
5
+ copyright : (C) 2007 by Martin Dobias
6
+ email : wonder.sk at gmail dot com
7
+ ***************************************************************************
8
+ * *
9
+ * This program is free software; you can redistribute it and/or modify *
10
+ * it under the terms of the GNU General Public License as published by *
11
+ * the Free Software Foundation; either version 2 of the License, or *
12
+ * (at your option) any later version. *
13
+ * *
14
+ ***************************************************************************/
15
+ /* $Id$ */
16
+
17
+ #ifndef QGSMAPTOOLEMITPOINT_H
18
+ #define QGSMAPTOOLEMITPOINT_H
19
+
20
+ #include " qgspoint.h"
21
+ #include " qgsmaptool.h"
22
+ class QgsMapCanvas ;
23
+
24
+ #include < QObject>
25
+
26
+ class QgsMapToolEmitPoint : public QObject , public QgsMapTool
27
+ {
28
+ Q_OBJECT
29
+
30
+ public:
31
+ // ! constructor
32
+ QgsMapToolEmitPoint (QgsMapCanvas* canvas);
33
+
34
+ // ! Overridden mouse move event
35
+ virtual void canvasMoveEvent (QMouseEvent * e);
36
+
37
+ // ! Overridden mouse press event - emits the signal
38
+ virtual void canvasPressEvent (QMouseEvent * e);
39
+
40
+ // ! Overridden mouse release event
41
+ virtual void canvasReleaseEvent (QMouseEvent * e);
42
+
43
+ signals:
44
+
45
+ // ! signal emitted on canvas click
46
+ void gotPoint (QgsPoint& point, Qt::MouseButton button);
47
+ };
48
+
49
+ #endif
You can’t perform that action at this time.
0 commit comments