Skip to content

Commit cb7b44d

Browse files
authoredOct 1, 2018
Merge pull request #8068 from m-kuhn/rubberbandProperties
Rubberband properties
2 parents 27e4b19 + b60f42c commit cb7b44d

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed
 

‎python/gui/auto_generated/qgsrubberband.sip.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99

1010

11-
class QgsRubberBand: QgsMapCanvasItem
11+
12+
13+
class QgsRubberBand : QObject, QgsMapCanvasItem
1214
{
1315
%Docstring
1416
A class for drawing transient features (e.g. digitizing lines) on the map.
@@ -22,6 +24,7 @@ for tracking the mouse while drawing polylines or polygons.
2224
%End
2325
public:
2426

27+
2528
enum IconType
2629
{
2730

‎python/gui/gui_auto.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
%Include auto_generated/qgsmaplayerconfigwidgetfactory.sip
1313
%Include auto_generated/qgsmapmouseevent.sip
1414
%Include auto_generated/qgsmaptip.sip
15-
%Include auto_generated/qgsrubberband.sip
1615
%Include auto_generated/qgssnapindicator.sip
1716
%Include auto_generated/qgstablewidgetitem.sip
1817
%Include auto_generated/qgsuserinputwidget.sip
@@ -188,6 +187,7 @@
188187
%Include auto_generated/qgsrasterlayersaveasdialog.sip
189188
%Include auto_generated/qgsrasterpyramidsoptionswidget.sip
190189
%Include auto_generated/qgsrelationeditorwidget.sip
190+
%Include auto_generated/qgsrubberband.sip
191191
%Include auto_generated/qgsscalecombobox.sip
192192
%Include auto_generated/qgsscalerangewidget.sip
193193
%Include auto_generated/qgsscalevisibilitydialog.sip

‎src/gui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ SET(QGIS_GUI_MOC_HDRS
522522
qgsrasterlayersaveasdialog.h
523523
qgsrasterpyramidsoptionswidget.h
524524
qgsrelationeditorwidget.h
525+
qgsrubberband.h
525526
qgsscalecombobox.h
526527
qgsscalerangewidget.h
527528
qgsscalevisibilitydialog.h
@@ -778,7 +779,6 @@ SET(QGIS_GUI_HDRS
778779
qgsmaplayerconfigwidgetfactory.h
779780
qgsmapmouseevent.h
780781
qgsmaptip.h
781-
qgsrubberband.h
782782
qgssnapindicator.h
783783
qgssqlcomposerdialog.h
784784
qgstablewidgetitem.h

‎src/gui/qgsrubberband.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#include <QPainter>
2424

2525
QgsRubberBand::QgsRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geometryType )
26-
: QgsMapCanvasItem( mapCanvas )
26+
: QObject( nullptr )
27+
, QgsMapCanvasItem( mapCanvas )
2728
, mGeometryType( geometryType )
2829
{
2930
reset( geometryType );
@@ -37,7 +38,8 @@ QgsRubberBand::QgsRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType
3738
}
3839

3940
QgsRubberBand::QgsRubberBand()
40-
: QgsMapCanvasItem( nullptr )
41+
: QObject( nullptr )
42+
, QgsMapCanvasItem( nullptr )
4143
{
4244
}
4345

‎src/gui/qgsrubberband.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
#include "qgsmapcanvasitem.h"
1919
#include "qgis.h"
2020
#include "qgsgeometry.h"
21+
2122
#include <QBrush>
2223
#include <QList>
2324
#include <QPen>
2425
#include <QPolygon>
26+
#include <QObject>
27+
2528
#include "qgis_gui.h"
2629

2730
class QgsVectorLayer;
@@ -34,10 +37,17 @@ class QPaintEvent;
3437
* The QgsRubberBand class provides a transparent overlay widget
3538
* for tracking the mouse while drawing polylines or polygons.
3639
*/
37-
class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
40+
class GUI_EXPORT QgsRubberBand : public QObject, public QgsMapCanvasItem
3841
{
42+
Q_OBJECT
3943
public:
4044

45+
Q_PROPERTY( QColor fillColor READ fillColor WRITE setFillColor )
46+
Q_PROPERTY( QColor strokeColor READ strokeColor WRITE setStrokeColor )
47+
Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize )
48+
Q_PROPERTY( QColor secondaryStrokeColor READ secondaryStrokeColor WRITE setSecondaryStrokeColor )
49+
Q_PROPERTY( int width READ width WRITE setWidth )
50+
4151
//! Icons
4252
enum IconType
4353
{

0 commit comments

Comments
 (0)
Please sign in to comment.