Merge pull request #8068 from m-kuhn/rubberbandProperties

Rubberband properties
This commit is contained in:
Matthias Kuhn 2018-10-01 12:35:35 +02:00 committed by GitHub
commit cb7b44d4eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 6 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

@ -12,7 +12,6 @@
%Include auto_generated/qgsmaplayerconfigwidgetfactory.sip
%Include auto_generated/qgsmapmouseevent.sip
%Include auto_generated/qgsmaptip.sip
%Include auto_generated/qgsrubberband.sip
%Include auto_generated/qgssnapindicator.sip
%Include auto_generated/qgstablewidgetitem.sip
%Include auto_generated/qgsuserinputwidget.sip
@ -188,6 +187,7 @@
%Include auto_generated/qgsrasterlayersaveasdialog.sip
%Include auto_generated/qgsrasterpyramidsoptionswidget.sip
%Include auto_generated/qgsrelationeditorwidget.sip
%Include auto_generated/qgsrubberband.sip
%Include auto_generated/qgsscalecombobox.sip
%Include auto_generated/qgsscalerangewidget.sip
%Include auto_generated/qgsscalevisibilitydialog.sip

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

@ -23,7 +23,8 @@
#include <QPainter>
QgsRubberBand::QgsRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geometryType )
: QgsMapCanvasItem( mapCanvas )
: QObject( nullptr )
, QgsMapCanvasItem( mapCanvas )
, mGeometryType( geometryType )
{
reset( geometryType );
@ -37,7 +38,8 @@ QgsRubberBand::QgsRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType
}
QgsRubberBand::QgsRubberBand()
: QgsMapCanvasItem( nullptr )
: QObject( nullptr )
, QgsMapCanvasItem( nullptr )
{
}

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,17 @@ 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 )
Q_PROPERTY( QColor strokeColor READ strokeColor WRITE setStrokeColor )
Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize )
Q_PROPERTY( QColor secondaryStrokeColor READ secondaryStrokeColor WRITE setSecondaryStrokeColor )
Q_PROPERTY( int width READ width WRITE setWidth )
//! Icons
enum IconType
{