40 mSnappingMarker.reset();
45 if ( !mSnappingMarker )
54 QColor color = s.
value( QStringLiteral(
"/qgis/digitizing/snap_color" ), QColor( Qt::magenta ) ).value<QColor>();
55 mSnappingMarker->setColor( color );
70 mSnappingMarker->setIconType( iconType );
72 mSnappingMarker->setCenter( match.
point() );
75 if ( s.
value( QStringLiteral(
"/qgis/digitizing/snap_tooltip" ),
false ).toBool() )
77 QPoint ptCanvas = mSnappingMarker->toCanvasCoordinates( match.
point() ).toPoint();
78 QPoint ptGlobal = mCanvas->mapToGlobal( ptCanvas );
79 QRect rect( ptCanvas.x(), ptCanvas.y(), 1, 1 );
80 QString layerName = match.
layer() ? match.
layer()->
name() : QString();
81 QToolTip::showText( ptGlobal, layerName, mCanvas, rect );
88 if ( mSnappingMarker )
89 mSnappingMarker->setVisible( visible );
94 if ( mSnappingMarker )
95 return mSnappingMarker->isVisible();
void setMatch(const QgsPointLocator::Match &match)
Sets snapping match that should be displayed in map canvas. Invalid match hides the indicator...
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
This class is a composition of two QSettings instances:
QgsPointLocator::Match match() const
Returns currently displayed snapping match.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly...
Map canvas is a class for displaying all GIS data types on a canvas.
A class for marking vertices of features using e.g.
QgsPointXY point() const
for vertex / edge match coords depending on what class returns it (geom.cache: layer coords...
bool isVisible() const
Returns whether the snapping indicator is visible.
void setVisible(bool visible=true)
Sets whether the snapping indicator is visible.
QgsSnapIndicator(QgsMapCanvas *canvas)
Constructs an indicator for the given map canvas.