Skip to content

Commit 3287604

Browse files
committedSep 30, 2018
Make QgsRubberBand fillColor a Q_PROPERTY
1 parent a0292c3 commit 3287604

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
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

‎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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ void QgsRubberBand::setColor( const QColor &color )
4949

5050
void QgsRubberBand::setFillColor( const QColor &color )
5151
{
52+
if ( mBrush.color() == color )
53+
return;
54+
5255
mBrush.setColor( color );
5356
}
5457

‎src/gui/qgsrubberband.h

Lines changed: 7 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,13 @@ 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+
4147
//! Icons
4248
enum IconType
4349
{

0 commit comments

Comments
 (0)
Please sign in to comment.