QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsmapcanvas.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmapcanvas.h - description
3 -------------------
4 begin : Sun Jun 30 2002
5 copyright : (C) 2002 by Gary E.Sherman
6 email : sherman at mrcc.com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSMAPCANVAS_H
19#define QGSMAPCANVAS_H
20
21#include "qgsconfig.h"
22#include "qgis_sip.h"
23
25#include "qgsrectangle.h"
26#include "qgsfeatureid.h"
27#include "qgsgeometry.h"
30#include "qgsproject.h"
31#include "qgsdistancearea.h"
32#include "qgsmaprendererjob.h"
33
34#include <QDomDocument>
35#include <QGraphicsView>
36
37#include "qgsmapsettings.h" // TEMPORARY
38#include "qgsprevieweffect.h" //for QgsPreviewEffect::PreviewMode
39
40#include <QTimer>
41#include <QGestureEvent>
42#include "qgis_gui.h"
43
44class QWheelEvent;
45class QPixmap;
46class QPaintEvent;
47class QKeyEvent;
48class ResizeEvent;
49
50class QColor;
51class QDomDocument;
52class QPaintDevice;
53class QMouseEvent;
54class QRubberBand;
55class QGraphicsScene;
56
57class QgsMapToPixel;
58class QgsMapLayer;
59class QgsHighlight;
60class QgsVectorLayer;
61
63
66class QgsMapSettings;
67class QgsMapCanvasMap;
69class QgsMapTool;
71class QgsRubberBand;
77
79class QgsScreenHelper;
80
82
83class QMenu;
85
86
92class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContextGenerator
93{
94#ifdef SIP_RUN
96 if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
97 sipType = sipType_QgsMapCanvas;
98 else
99 sipType = nullptr;
100 SIP_END
101#endif
102
103 Q_OBJECT
104 Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
105 Q_PROPERTY( bool previewJobsEnabled READ previewJobsEnabled WRITE setPreviewJobsEnabled )
106
107 public:
109 QgsMapCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr );
110
111 ~QgsMapCanvas() override;
112
123 void addOverlayWidget( QWidget *widget SIP_TRANSFER, Qt::Edge edge );
124
128 double magnificationFactor() const;
129
140 void setLayers( const QList<QgsMapLayer *> &layers );
141
148 void setFlags( Qgis::MapCanvasFlags flags );
149
156 Qgis::MapCanvasFlags flags() const;
157
158 void setCurrentLayer( QgsMapLayer *layer );
159
163 const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
164
171 QgsMapSettings &mapSettings() SIP_SKIP;
172
179 void setTemporalController( QgsTemporalController *controller );
180
187 const QgsTemporalController *temporalController() const;
188
192 void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
193
197 void setMapSettingsFlags( Qgis::MapSettingsFlags flags );
198
206 const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
207
217 const QgsRenderedItemResults *renderedItemResults( bool allowOutdatedResults = true ) const;
218
226 void setCachingEnabled( bool enabled );
227
235 bool isCachingEnabled() const;
236
240 void clearCache();
241
250 QgsMapRendererCache *cache();
251
256 void cancelJobs() SIP_SKIP;
257
266 void waitWhileRendering();
267
271 void setParallelRenderingEnabled( bool enabled );
272
276 bool isParallelRenderingEnabled() const;
277
281 void setMapUpdateInterval( int timeMilliseconds );
282
286 int mapUpdateInterval() const;
287
292 double scale() const;
293
295 double mapUnitsPerPixel() const;
296
298 QgsRectangle extent() const;
299
308 QgsRectangle fullExtent() const;
309
319 QgsRectangle projectExtent() const;
320
332 void setExtent( const QgsRectangle &r, bool magnified = false );
333
342 bool setReferencedExtent( const QgsReferencedRectangle &extent ) SIP_THROW( QgsCsException );
343
347 double rotation() const;
348
352 void setRotation( double degrees );
353
357 void setCenter( const QgsPointXY &center );
358
362 QgsPointXY center() const;
363
369 void zoomToFullExtent();
370
379 void zoomToProjectExtent();
380
382 void zoomToPreviousExtent();
383
385 void zoomToNextExtent();
386
388 void clearExtentHistory();
389
390
396 void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
397
404 void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
405
407 void panToSelected( QgsMapLayer *layer = nullptr );
408
414 void panToSelected( const QList<QgsMapLayer *> &layers );
415
427 void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ), int flashes = 3, int duration = 500 );
428
440 void flashGeometries( const QList<QgsGeometry> &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(), const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ), int flashes = 3, int duration = 500 );
441
443 void setMapTool( QgsMapTool *mapTool, bool clean = false );
444
452 void unsetMapTool( QgsMapTool *mapTool );
453
455 QgsMapTool *mapTool() const;
456
462 void setProject( QgsProject *project );
463
470 QgsProject *project();
471
473 void setCanvasColor( const QColor &_newVal );
475 QColor canvasColor() const;
476
480 void setSelectionColor( const QColor &color );
481
485 QColor selectionColor() const;
486
488 void updateScale();
489
491 QgsMapLayer *layer( int index );
492
503 QgsMapLayer *layer( const QString &id );
504
508 int layerCount() const;
509
518 QList<QgsMapLayer *> layers( bool expandGroupLayers = false ) const;
519
520#ifndef SIP_RUN
527 template<typename T>
528 QVector<T> layers() const { return mapSettings().layers<T>(); }
529#endif
530
542 void freeze( bool frozen = true );
543
553 bool isFrozen() const;
554
565 bool renderFlag() const { return mRenderFlag; }
566
571 Qgis::DistanceUnit mapUnits() const;
572
577 QMap<QString, QString> layerStyleOverrides() const;
578
589 void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
590
608 void setTheme( const QString &theme );
609
614 QString theme() const { return mTheme; }
615
617 const QgsMapToPixel *getCoordinateTransform();
618
620 bool isDrawing();
621
623 QgsMapLayer *currentLayer();
624
626 void setWheelFactor( double factor );
627
635 void zoomScale( double scale, bool ignoreScaleLock = false );
636
644 void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
645
647 void zoomWithCenter( int x, int y, bool zoomIn );
648
653 void zoomToFeatureExtent( QgsRectangle &rect );
654
659 bool scaleLocked() const { return mScaleLocked; }
660
662 void enableAntiAliasing( bool flag );
663
665 bool antiAliasingEnabled() const;
666
668 void enableMapTileRendering( bool flag );
669
670 // following 2 methods should be moved elsewhere or changed to private
671 // currently used by pan map tool
673 void panActionEnd( QPoint releasePoint );
674
675#ifndef SIP_RUN
676
682 void panActionStart( QPoint releasePoint );
683#endif
684
686 void panAction( QMouseEvent *event );
687
689 QPoint mouseLastXY();
690
696 void setPreviewModeEnabled( bool previewEnabled );
697
704 bool previewModeEnabled() const;
705
714 void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
715
723 QgsPreviewEffect::PreviewMode previewMode() const;
724
732 QgsSnappingUtils *snappingUtils() const;
733
741 void setSnappingUtils( QgsSnappingUtils *utils );
742
752 void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
753
761 QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
762
770 {
771 return mExpressionContextScope;
772 }
773
780 QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
781
782 QgsExpressionContext createExpressionContext() const override;
783
788 void setSegmentationTolerance( double tolerance );
789
794 void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
795
799 QList<QgsMapCanvasAnnotationItem *> annotationItems() const;
800
805 bool annotationsVisible() const { return mAnnotationsVisible; }
806
811 void setAnnotationsVisible( bool visible );
812
816 void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
817
821 const QgsLabelingEngineSettings &labelingEngineSettings() const;
822
830 bool previewJobsEnabled() const;
831
839 void setPreviewJobsEnabled( bool enabled );
840
846 void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler>> &handlers ) SIP_SKIP;
847
858 void setTemporalRange( const QgsDateTimeRange &range );
859
866 const QgsDateTimeRange &temporalRange() const;
867
879 void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
880
888 void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
889
895 bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
896
904 void setMapController( QgsAbstract2DMapController *controller SIP_TRANSFER );
905
906 public slots:
907
909 void refresh();
910
919 void refreshAllLayers();
920
929 void redrawAllLayers();
930
932 void selectionChangedSlot();
933
935 void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
936
938 void layerStateChange();
939
949 void setRenderFlag( bool flag );
950
954 void stopRendering();
955
957 void readProject( const QDomDocument & );
958
960 void writeProject( QDomDocument & );
961
969 void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
970
975 void setScaleLocked( bool isLocked );
976
978 void zoomIn();
979
981 void zoomOut();
982
987 void zoomToSelected( QgsMapLayer *layer = nullptr );
988
994 void zoomToSelected( const QList<QgsMapLayer *> &layers );
995
1001 void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
1002
1006 double zoomInFactor() const;
1007
1011 double zoomOutFactor() const;
1012
1018 const QList<double> &zoomResolutions() const { return mZoomResolutions; }
1019
1028 QgsDoubleRange zRange() const;
1029
1038 void setZRange( const QgsDoubleRange &range );
1039
1040 private slots:
1042 void mapToolDestroyed();
1043
1045 void rendererJobFinished();
1046
1048 void previewJobFinished();
1049
1050 void mapUpdateTimeout();
1051
1052 void refreshMap();
1053
1054 void mapThemeChanged( const QString &theme );
1056 void mapThemeRenamed( const QString &theme, const QString &newTheme );
1057
1058 void updateDevicePixelFromScreen();
1059
1060 void onElevationShadingRendererChanged();
1061
1062 signals:
1063
1068 void xyCoordinates( const QgsPointXY &p );
1069
1071 void scaleChanged( double scale );
1072
1079 void scaleLockChanged( bool locked );
1080
1081
1084
1088 void rotationChanged( double rotation );
1089
1093 void magnificationChanged( double magnification );
1094
1099
1100 // TODO: deprecate when decorations are reimplemented as map canvas items
1101
1112 void renderComplete( QPainter *painter );
1113
1114 // ### QGIS 3: renamte to mapRefreshFinished()
1117
1118 // ### QGIS 3: rename to mapRefreshStarted()
1121
1127
1130
1132 void keyPressed( QKeyEvent *e );
1133
1135 void keyReleased( QKeyEvent *e );
1136
1140 void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1141
1148
1150 void zoomLastStatusChanged( bool available );
1151
1153 void zoomNextStatusChanged( bool available );
1154
1159
1164
1169
1174
1179 void themeChanged( const QString &theme );
1180
1182 void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel level = Qgis::MessageLevel::Info );
1183
1191 void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1192
1203 void panDistanceBearingChanged( double distance, Qgis::DistanceUnit unit, double bearing );
1204
1209 void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1210
1217
1227
1234 void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1235
1236 protected:
1237 bool event( QEvent *e ) override;
1238 void keyPressEvent( QKeyEvent *e ) override;
1239 void keyReleaseEvent( QKeyEvent *e ) override;
1240 void mouseDoubleClickEvent( QMouseEvent *e ) override;
1241 void mouseMoveEvent( QMouseEvent *e ) override;
1242 void mousePressEvent( QMouseEvent *e ) override;
1243 void mouseReleaseEvent( QMouseEvent *e ) override;
1244 void wheelEvent( QWheelEvent *e ) override;
1245 void resizeEvent( QResizeEvent *e ) override;
1246 void paintEvent( QPaintEvent *e ) override;
1247 void dragEnterEvent( QDragEnterEvent *e ) override;
1248 bool viewportEvent( QEvent *event ) override;
1249
1251 void moveCanvasContents( bool reset = false );
1252
1253 void dropEvent( QDropEvent *event ) override;
1254
1255 void showEvent( QShowEvent *event ) override;
1256
1262 void emitExtentsChanged();
1263
1265 class CanvasProperties;
1266
1268 std::unique_ptr<CanvasProperties> mCanvasProperties;
1269
1270#if 0
1271
1276 void connectNotify( const char *signal ) override;
1277#endif
1278
1279 protected slots:
1281 void updateCanvasItemPositions();
1282
1283 private slots:
1284
1285 void layerRepaintRequested( bool deferred );
1286
1287 void autoRefreshTriggered();
1288
1289 void updateAutoRefreshTimer();
1290
1291 void projectThemesChanged();
1292
1293 void startPreviewJob( int number );
1294
1295 void temporalControllerModeChanged();
1296
1297 private:
1298 // Restore scale RAII
1299 class ScaleRestorer
1300 {
1301 public:
1302 ScaleRestorer( QgsMapCanvas *canvas )
1303 : mCanvas( canvas )
1304 {
1305 mLockedScale = mCanvas->mapSettings().scale();
1306 };
1307
1308 ~ScaleRestorer()
1309 {
1310 QgsRectangle newExtent = mCanvas->mapSettings().extent();
1311 newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1312 mCanvas->mSettings.setExtent( newExtent );
1313 };
1314
1315 private:
1316 QgsMapCanvas *mCanvas;
1317 double mLockedScale;
1318 };
1319
1320 enum class CacheInvalidationType
1321 {
1322 Temporal = 1 << 0,
1323 Elevation = 1 << 1,
1324 };
1325
1326 QgsOverlayWidgetLayout *mLayout = nullptr;
1327
1328 Qgis::MapCanvasFlags mFlags;
1329
1331 QgsMapSettings mSettings;
1332
1334 QgsMapCanvasMap *mMap = nullptr;
1335
1336 QgsScreenHelper *mScreenHelper = nullptr;
1337
1342 QgsTemporalController *mController = nullptr;
1343
1345 bool mFrozen = false;
1346
1348 bool mRefreshScheduled = false;
1349
1351 bool mRefreshAfterJob = false;
1352
1354 bool mRenderFlag = true;
1355
1356 QFlags<CacheInvalidationType> mCacheInvalidations;
1357
1359 QPointer<QgsMapLayer> mCurrentLayer;
1360
1362 QGraphicsScene *mScene = nullptr;
1363
1365 QgsMapTool *mMapTool = nullptr;
1366
1368 QgsProject *mProject = nullptr;
1369
1371 QList<QgsRectangle> mLastExtent;
1372 int mLastExtentIndex = -1;
1373
1375 double mWheelZoomFactor = 2.0;
1376
1378 QTimer mMapUpdateTimer;
1379
1381 QgsMapRendererQImageJob *mJob = nullptr;
1382
1384 bool mJobCanceled = false;
1385
1387 std::unique_ptr<QgsLabelingResults> mLabelingResults;
1388
1390 bool mLabelingResultsOutdated = false;
1391
1396 std::unique_ptr<QgsRenderedItemResults> mRenderedItemResults;
1397
1402 std::unique_ptr<QgsRenderedItemResults> mPreviousRenderedItemResults;
1403
1409 bool mRenderedItemResultsOutdated = false;
1410
1412 bool mUseParallelRendering = false;
1413
1415 bool mDrawRenderingStats = false;
1416
1418 QgsMapRendererCache *mCache = nullptr;
1419
1420 QTimer *mResizeTimer = nullptr;
1421 QTimer *mRefreshTimer = nullptr;
1422
1423 QgsPreviewEffect *mPreviewEffect = nullptr;
1424
1425 QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1426
1427 QgsSnappingUtils *mSnappingUtils = nullptr;
1428
1429 QList<QgsMapRendererQImageJob *> mPreviewJobs;
1430
1432 bool mScaleLocked = false;
1433
1434 QgsExpressionContextScope mExpressionContextScope;
1435
1437 QRect mZoomRect;
1438
1440 bool mZoomDragging = false;
1441
1443 std::unique_ptr<QgsRubberBand> mZoomRubberBand;
1444
1445 QCursor mZoomCursor;
1446
1447 QTimer mAutoRefreshTimer;
1448
1449 QTimer mPreviewTimer;
1450 QMetaObject::Connection mPreviewTimerConnection;
1451
1452 QString mTheme;
1453
1454 QgsPointXY mCursorPoint;
1455
1456 bool mAnnotationsVisible = true;
1457
1458 bool mUsePreviewJobs = false;
1459
1460 QHash<QString, int> mLastLayerRenderTime;
1461
1462 QVector<QPointer<QgsCustomDropHandler>> mDropHandlers;
1463
1464 QgsDistanceArea mDa;
1465 QList<double> mZoomResolutions;
1466
1467 QList<QgsMapCanvasInteractionBlocker *> mInteractionBlockers;
1468
1469 int mBlockItemPositionUpdates = 0;
1470 int mBlockExtentChangedSignal = 0;
1471 int mBlockScaleChangedSignal = 0;
1472
1473 std::unique_ptr<QgsTemporaryCursorOverride> mTemporaryCursorOverride;
1474
1482 QMap<QString, QDateTime> mRendererErrors;
1483
1484
1485 QPointer<QgsAbstract2DMapController> mMapController;
1486
1491 QgsPointXY cursorPoint() const;
1492
1496 void updateMapSize();
1497
1502 void beginZoomRect( QPoint pos );
1503
1508 void endZoomRect( QPoint pos );
1509
1511 void stopZoomRect();
1512
1514 void startPan();
1515
1517 void stopPan();
1518
1527 bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1528
1535 QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1536
1537 void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1538
1539 void startPreviewJobs();
1540 void stopPreviewJobs();
1541 void schedulePreviewJob( int number );
1542
1546 bool panOperationInProgress();
1547
1548 int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1549
1554 void clearTemporalCache();
1555
1559 void clearElevationCache();
1560
1561 void showContextMenu( QgsMapMouseEvent *event );
1562
1567 void notifyRendererErrors( const QgsMapRendererJob::Errors &errors );
1568
1569 friend class TestQgsMapCanvas;
1570
1571}; // class QgsMapCanvas
1572
1573// clazy:excludeall=qstring-allocations
1574
1575#endif
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
DistanceUnit
Units of distance.
Definition qgis.h:4722
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:154
@ Info
Information message.
Definition qgis.h:155
QFlags< MapCanvasFlag > MapCanvasFlags
Flags controlling behavior of map canvases.
Definition qgis.h:3264
Abstract base class for all 2D map controllers.
Abstract base class for all geometries.
This class represents a coordinate reference system (CRS).
Custom exception class for Coordinate Reference System related exceptions.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
QgsRange which stores a range of double values.
Definition qgsrange.h:231
Abstract interface for generating an expression context.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A geometry is the spatial representation of a feature.
A class for highlight features on the map.
Stores global configuration for labeling engine.
Class that stores computed placement from labeling engine.
An interactive map canvas item which displays a QgsAnnotation.
An interface for objects which block interactions with a QgsMapCanvas.
Interaction
Available interactions to block.
Deprecated to be deleted, stuff from here should be moved elsewhere.
Map canvas is a class for displaying all GIS data types on a canvas.
void contextMenuAboutToShow(QMenu *menu, QgsMapMouseEvent *event)
Emitted before the map canvas context menu will be shown.
void selectionChanged(QgsMapLayer *layer)
Emitted when selection in any layer gets changed.
void extentsChanged()
Emitted when the extents of the map change.
void xyCoordinates(const QgsPointXY &p)
Emits current mouse position.
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
void setZoomResolutions(const QList< double > &resolutions)
Set a list of resolutions (map units per pixel) to which to "snap to" when zooming the map.
QString theme() const
Returns the map's theme shown in the canvas, if set.
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
void tapAndHoldGestureOccurred(const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture)
Emitted whenever a tap and hold gesture occurs at the specified map point.
const QList< double > & zoomResolutions() const
void panDistanceBearingChanged(double distance, Qgis::DistanceUnit unit, double bearing)
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
bool scaleLocked() const
Returns whether the scale is locked, so zooming can be performed using magnication.
void zRangeChanged()
Emitted when the map canvas z (elevation) range changes.
void scaleChanged(double scale)
Emitted when the scale of the map changes.
void mapToolSet(QgsMapTool *newTool, QgsMapTool *oldTool)
Emit map tool changed with the old tool.
void canvasColorChanged()
Emitted when canvas background color changes.
void magnificationChanged(double magnification)
Emitted when the scale of the map changes.
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
void renderErrorOccurred(const QString &error, QgsMapLayer *layer)
Emitted whenever an error is encountered during a map render operation.
void mapRefreshCanceled()
Emitted when the pending map refresh has been canceled.
void renderStarting()
Emitted when the canvas is about to be rendered.
std::unique_ptr< CanvasProperties > mCanvasProperties
Handle pattern for implementation object.
void keyReleased(QKeyEvent *e)
Emit key release event.
const QgsExpressionContextScope & expressionContextScope() const
Returns a const reference to the expression context scope for the map canvas.
void layerStyleOverridesChanged()
Emitted when the configuration of overridden layer styles changes.
void zoomNextStatusChanged(bool available)
Emitted when zoom next status changed.
void rotationChanged(double rotation)
Emitted when the rotation of the map changes.
void messageEmitted(const QString &title, const QString &message, Qgis::MessageLevel level=Qgis::MessageLevel::Info)
emit a message (usually to be displayed in a message bar)
void scaleLockChanged(bool locked)
Emitted when the scale locked state of the map changes.
bool renderFlag() const
Returns true if canvas render is disabled as a result of user disabling renders via the GUI.
void temporalRangeChanged()
Emitted when the map canvas temporal range changes.
void zoomLastStatusChanged(bool available)
Emitted when zoom last status changed.
void themeChanged(const QString &theme)
Emitted when the canvas has been assigned a different map theme.
void destinationCrsChanged()
Emitted when map CRS has changed.
void transformContextChanged()
Emitted when the canvas transform context is changed.
void keyPressed(QKeyEvent *e)
Emit key press event.
void mapCanvasRefreshed()
Emitted when canvas finished a refresh request.
void layersChanged()
Emitted when a new set of layers has been received.
void renderComplete(QPainter *painter)
Emitted when the canvas has rendered.
void setExpressionContextScope(const QgsExpressionContextScope &scope)
Sets an expression context scope for the map canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
A widget that displays an overview map.
This class is responsible for keeping cache of rendered images resulting from a map rendering job.
QList< QgsMapRendererJob::Error > Errors
Intermediate base class adding functionality that allows client to query the rendered image.
The QgsMapSettings class contains configuration for rendering of the map.
Perform transforms between map coordinates and device coordinates.
Abstract base class for all map tools.
Definition qgsmaptool.h:71
A custom layout which can be used to overlay child widgets over a parent widget.
A class to represent a 2D point.
Definition qgspointxy.h:60
A graphics effect which can be applied to a widget to simulate various printing and color blindness m...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
A rectangle specified with double values.
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
A QgsRectangle with associated coordinate reference system.
Stores collated details of rendered items during a map rendering operation.
A class for drawing transient features (e.g.
A utility class for dynamic handling of changes to screen properties.
This class has all the configuration of snapping and can return answers to snapping queries.
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
Represents a vector layer which manages a vector based data sets.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_KEEPREFERENCE
Definition qgis_sip.h:86
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_THROW(name,...)
Definition qgis_sip.h:203
#define SIP_END
Definition qgis_sip.h:208
QSet< QgsFeatureId > QgsFeatureIds
const QgsCoordinateReferenceSystem & crs