QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
QgsModelViewRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsModelGraphicsView widgets. More...
#include <qgsmodelviewrubberband.h>
Signals | |
void | sizeChanged (const QString &size) |
Emitted when the size of the rubber band is changed. | |
Public Member Functions | |
QgsModelViewRubberBand (QgsModelGraphicsView *view=nullptr) | |
Constructor for QgsModelViewRubberBand. | |
~QgsModelViewRubberBand () override=default | |
QBrush | brush () const |
Returns the brush used for drawing the rubber band. | |
virtual QgsModelViewRubberBand * | create (QgsModelGraphicsView *view) const =0 |
Creates a new instance of the QgsModelViewRubberBand subclass. | |
virtual QRectF | finish (QPointF position=QPointF(), Qt::KeyboardModifiers modifiers=Qt::KeyboardModifiers())=0 |
Called when a rubber band use has finished and the rubber band is no longer required. | |
QPen | pen () const |
Returns the pen used for drawing the rubber band. | |
void | setBrush (const QBrush &brush) |
Sets the brush used for drawing the rubber band. | |
void | setPen (const QPen &pen) |
Sets the pen used for drawing the rubber band. | |
virtual void | start (QPointF position, Qt::KeyboardModifiers modifiers)=0 |
Called when a rubber band should be created at the specified starting position (in model coordinate space). | |
virtual void | update (QPointF position, Qt::KeyboardModifiers modifiers)=0 |
Called when a rubber band should be updated to reflect a temporary ending position (in model coordinate space). | |
QgsModelGraphicsView * | view () const |
Returns the view associated with the rubber band. | |
Protected Member Functions | |
QRectF | updateRect (QPointF start, QPointF position, bool constrainSquare, bool fromCenter) |
Calculates an updated bounding box rectangle from a original start position and new position. | |
QgsModelViewRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsModelGraphicsView widgets.
Definition at line 38 of file qgsmodelviewrubberband.h.
QgsModelViewRubberBand::QgsModelViewRubberBand | ( | QgsModelGraphicsView * | view = nullptr | ) |
Constructor for QgsModelViewRubberBand.
Definition at line 23 of file qgsmodelviewrubberband.cpp.
|
overridedefault |
QBrush QgsModelViewRubberBand::brush | ( | ) | const |
Returns the brush used for drawing the rubber band.
Definition at line 107 of file qgsmodelviewrubberband.cpp.
|
pure virtual |
Creates a new instance of the QgsModelViewRubberBand subclass.
Implemented in QgsModelViewRectangularRubberBand.
|
pure virtual |
Called when a rubber band use has finished and the rubber band is no longer required.
Returns the final bounding box of the rubber band.
Implemented in QgsModelViewRectangularRubberBand.
QPen QgsModelViewRubberBand::pen | ( | ) | const |
Returns the pen used for drawing the rubber band.
Definition at line 97 of file qgsmodelviewrubberband.cpp.
void QgsModelViewRubberBand::setBrush | ( | const QBrush & | brush | ) |
Sets the brush used for drawing the rubber band.
Definition at line 112 of file qgsmodelviewrubberband.cpp.
void QgsModelViewRubberBand::setPen | ( | const QPen & | pen | ) |
Sets the pen used for drawing the rubber band.
Definition at line 102 of file qgsmodelviewrubberband.cpp.
|
signal |
Emitted when the size of the rubber band is changed.
The size argument gives a translated string describing the new rubber band size, with a format which differs per subclass (e.g. rectangles may describe a size using width and height, while circles may describe a size by radius).
|
pure virtual |
Called when a rubber band should be created at the specified starting position (in model coordinate space).
Implemented in QgsModelViewRectangularRubberBand.
|
pure virtual |
Called when a rubber band should be updated to reflect a temporary ending position (in model coordinate space).
Implemented in QgsModelViewRectangularRubberBand.
|
protected |
Calculates an updated bounding box rectangle from a original start position and new position.
If constrainSquare is true
then the bounding box will be forced to a square shape. If fromCenter is true
then the original start position will form the center point of the returned rectangle.
Definition at line 34 of file qgsmodelviewrubberband.cpp.
QgsModelGraphicsView * QgsModelViewRubberBand::view | ( | ) | const |
Returns the view associated with the rubber band.
Definition at line 29 of file qgsmodelviewrubberband.cpp.