QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
34 mCanvasDestroyedConnection = QObject::connect( canvas, &QgsMapCanvas::destroyed, canvas, [ = ]()
37 mSnappingMarker =
nullptr;
43 if ( mSnappingMarker && mCanvas )
45 mCanvas->scene()->removeItem( mSnappingMarker );
46 delete mSnappingMarker;
49 QObject::disconnect( mCanvasDestroyedConnection );
58 if ( mSnappingMarker )
60 mCanvas->scene()->removeItem( mSnappingMarker );
61 delete mSnappingMarker;
63 mSnappingMarker =
nullptr;
68 if ( !mSnappingMarker )
77 QColor color = s.
value( QStringLiteral(
"/qgis/digitizing/snap_color" ), QColor( Qt::magenta ) ).value<QColor>();
110 if ( s.
value( QStringLiteral(
"/qgis/digitizing/snap_tooltip" ),
false ).toBool() )
113 QPoint ptGlobal = mCanvas->mapToGlobal( ptCanvas );
114 QRect rect( ptCanvas.x(), ptCanvas.y(), 1, 1 );
116 QToolTip::showText( ptGlobal, layerName, mCanvas, rect );
123 if ( mSnappingMarker )
124 mSnappingMarker->setVisible( visible );
129 if ( mSnappingMarker )
130 return mSnappingMarker->isVisible();
void setVisible(bool visible=true)
Sets whether the snapping indicator is visible.
bool hasMiddleSegment() const
Returns true if the Match is the middle of a segment.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setIconType(int iconType)
@ ICON_TRIANGLE
Added in QGIS 3.12.
QgsPointLocator::Match match() const
Returns currently displayed snapping match.
QgsPointXY point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords,...
void setIconSize(int iconSize)
@ ICON_DOUBLE_TRIANGLE
Added in QGIS 3.0.
bool hasVertex() const
Returns true if the Match is a vertex.
bool hasCentroid() const
Returns true if the Match is a centroid.
@ ICON_RHOMBUS
Added in QGIS 3.12.
QPointF toCanvasCoordinates(const QgsPointXY &point) const
transformation from map coordinates to screen coordinates
void setMatch(const QgsPointLocator::Match &match)
Sets snapping match that should be displayed in map canvas. Invalid match hides the indicator.
void setPenWidth(int width)
void setCenter(const QgsPointXY &point)
void setColor(const QColor &color)
Sets the stroke color for the marker.
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
bool isVisible() const
Returns whether the snapping indicator is visible.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
QgsSnapIndicator(QgsMapCanvas *canvas)
Constructs an indicator for the given map canvas.
bool hasArea() const
Returns true if the Match is an area.