Make QgsRubberBand fillColor a Q_PROPERTY

This commit is contained in:
Matthias Kuhn 2018-09-30 09:37:59 +02:00
parent a0292c3ff3
commit 328760437c
No known key found for this signature in database
GPG Key ID: 7A7F1A1C90C3E6A7
4 changed files with 15 additions and 3 deletions

View File

@ -8,7 +8,9 @@
class QgsRubberBand: QgsMapCanvasItem
class QgsRubberBand : QObject, QgsMapCanvasItem
{
%Docstring
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.
%End
public:
enum IconType
{

View File

@ -522,6 +522,7 @@ SET(QGIS_GUI_MOC_HDRS
qgsrasterlayersaveasdialog.h
qgsrasterpyramidsoptionswidget.h
qgsrelationeditorwidget.h
qgsrubberband.h
qgsscalecombobox.h
qgsscalerangewidget.h
qgsscalevisibilitydialog.h
@ -778,7 +779,6 @@ SET(QGIS_GUI_HDRS
qgsmaplayerconfigwidgetfactory.h
qgsmapmouseevent.h
qgsmaptip.h
qgsrubberband.h
qgssnapindicator.h
qgssqlcomposerdialog.h
qgstablewidgetitem.h

View File

@ -49,6 +49,9 @@ void QgsRubberBand::setColor( const QColor &color )
void QgsRubberBand::setFillColor( const QColor &color )
{
if ( mBrush.color() == color )
return;
mBrush.setColor( color );
}

View File

@ -18,10 +18,13 @@
#include "qgsmapcanvasitem.h"
#include "qgis.h"
#include "qgsgeometry.h"
#include <QBrush>
#include <QList>
#include <QPen>
#include <QPolygon>
#include <QObject>
#include "qgis_gui.h"
class QgsVectorLayer;
@ -34,10 +37,13 @@ class QPaintEvent;
* The QgsRubberBand class provides a transparent overlay widget
* for tracking the mouse while drawing polylines or polygons.
*/
class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
class GUI_EXPORT QgsRubberBand : public QObject, public QgsMapCanvasItem
{
Q_OBJECT
public:
Q_PROPERTY( QColor fillColor READ fillColor WRITE setFillColor )
//! Icons
enum IconType
{