Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubberband properties #8068

Merged
merged 4 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/gui/auto_generated/qgsrubberband.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -22,6 +24,7 @@ for tracking the mouse while drawing polylines or polygons.
%End
public:


enum IconType
{

Expand Down
2 changes: 1 addition & 1 deletion python/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ SET(QGIS_GUI_MOC_HDRS
qgsrasterlayersaveasdialog.h
qgsrasterpyramidsoptionswidget.h
qgsrelationeditorwidget.h
qgsrubberband.h
qgsscalecombobox.h
qgsscalerangewidget.h
qgsscalevisibilitydialog.h
Expand Down Expand Up @@ -778,7 +779,6 @@ SET(QGIS_GUI_HDRS
qgsmaplayerconfigwidgetfactory.h
qgsmapmouseevent.h
qgsmaptip.h
qgsrubberband.h
qgssnapindicator.h
qgssqlcomposerdialog.h
qgstablewidgetitem.h
Expand Down
6 changes: 4 additions & 2 deletions src/gui/qgsrubberband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include <QPainter>

QgsRubberBand::QgsRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType geometryType )
: QgsMapCanvasItem( mapCanvas )
: QObject( nullptr )
, QgsMapCanvasItem( mapCanvas )
, mGeometryType( geometryType )
{
reset( geometryType );
Expand All @@ -37,7 +38,8 @@ QgsRubberBand::QgsRubberBand( QgsMapCanvas *mapCanvas, QgsWkbTypes::GeometryType
}

QgsRubberBand::QgsRubberBand()
: QgsMapCanvasItem( nullptr )
: QObject( nullptr )
, QgsMapCanvasItem( nullptr )
{
}

Expand Down
12 changes: 11 additions & 1 deletion src/gui/qgsrubberband.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down