Subgroup: Map
Class: QgsMapMouseEvent¶
-
class
qgis.gui.
QgsMapMouseEvent
¶ Bases:
PyQt5.QtGui.QMouseEvent
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas. It is sent whenever the user moves, clicks, releases or double clicks the mouse. In addition to the coordinates in pixel space it also knows the coordinates in the mapcanvas’ CRS as well as it knows the concept of snapping.
Methods
accept
button
buttons
flags
globalPos
globalX
globalY
ignore
isAccepted
isSnapped
Returns true if there is a snapped point cached. localPos
mapPoint
mapPoint returns the point in coordinates mapPointMatch
Returns the matching data from the most recently snapped point. modifiers
originalMapPoint
Returns the original, unmodified map point of the mouse cursor. originalPixelPoint
The unsnapped, real mouse cursor position in pixel coordinates. pixelPoint
The snapped mouse cursor in pixel coordinates. pos
registerEventType
screenPos
setAccepted
setMapPoint
Set the (snapped) point this event points to in map coordinates. setTimestamp
snapPoint
snapPoint will snap the points using the map canvas snapping utils configuration source
spontaneous
timestamp
type
windowPos
x
y
Attributes
ActionAdded
ActionChanged
ActionRemoved
ActivationChange
ApplicationActivate
ApplicationActivated
ApplicationDeactivate
ApplicationDeactivated
ApplicationFontChange
ApplicationLayoutDirectionChange
ApplicationPaletteChange
ApplicationStateChange
ApplicationWindowIconChange
ChildAdded
ChildPolished
ChildRemoved
Clipboard
Close
CloseSoftwareInputPanel
ContentsRectChange
ContextMenu
CursorChange
DeferredDelete
DragEnter
DragLeave
DragMove
Drop
DynamicPropertyChange
EnabledChange
Enter
EnterWhatsThisMode
Expose
FileOpen
FocusAboutToChange
FocusIn
FocusOut
FontChange
Gesture
GestureOverride
GrabKeyboard
GrabMouse
GraphicsSceneContextMenu
GraphicsSceneDragEnter
GraphicsSceneDragLeave
GraphicsSceneDragMove
GraphicsSceneDrop
GraphicsSceneHelp
GraphicsSceneHoverEnter
GraphicsSceneHoverLeave
GraphicsSceneHoverMove
GraphicsSceneMouseDoubleClick
GraphicsSceneMouseMove
GraphicsSceneMousePress
GraphicsSceneMouseRelease
GraphicsSceneMove
GraphicsSceneResize
GraphicsSceneWheel
Hide
HideToParent
HoverEnter
HoverLeave
HoverMove
IconDrag
IconTextChange
InputMethod
InputMethodQuery
KeyPress
KeyRelease
KeyboardLayoutChange
LanguageChange
LayoutDirectionChange
LayoutRequest
Leave
LeaveWhatsThisMode
LocaleChange
MacSizeChange
MaxUser
MetaCall
ModifiedChange
MouseButtonDblClick
MouseButtonPress
MouseButtonRelease
MouseMove
MouseTrackingChange
Move
NonClientAreaMouseButtonDblClick
NonClientAreaMouseButtonPress
NonClientAreaMouseButtonRelease
NonClientAreaMouseMove
None_
OkRequest
OrientationChange
Paint
PaletteChange
ParentAboutToChange
ParentChange
PlatformPanel
PlatformSurface
Polish
PolishRequest
QueryWhatsThis
ReadOnlyChange
RequestSoftwareInputPanel
Resize
Scroll
ScrollPrepare
Shortcut
ShortcutOverride
Show
ShowToParent
SockAct
StateMachineSignal
StateMachineWrapped
StatusTip
StyleChange
TabletEnterProximity
TabletLeaveProximity
TabletMove
TabletPress
TabletRelease
TabletTrackingChange
ThreadChange
Timer
ToolBarChange
ToolTip
ToolTipChange
TouchBegin
TouchCancel
TouchEnd
TouchUpdate
UngrabKeyboard
UngrabMouse
UpdateLater
UpdateRequest
User
WhatsThis
WhatsThisClicked
Wheel
WinEventAct
WinIdChange
WindowActivate
WindowBlocked
WindowDeactivate
WindowIconChange
WindowStateChange
WindowTitleChange
WindowUnblocked
ZOrderChange
-
isSnapped
(self) → bool¶ Returns true if there is a snapped point cached. Will only be useful after snapPoint has previously been called.
Returns: True if there is a snapped point cached.
-
mapPoint
(self) → QgsPointXY¶ mapPoint returns the point in coordinates
Returns: the point in map coordinates, after snapping if requested in the event.
-
mapPointMatch
(self) → QgsPointLocator.Match¶ Returns the matching data from the most recently snapped point.
Returns: the snapping data structure New in version 2.14.
-
originalMapPoint
(self) → QgsPointXY¶ Returns the original, unmodified map point of the mouse cursor.
Returns: The cursor position in map coordinates.
-
originalPixelPoint
(self) → QPoint¶ The unsnapped, real mouse cursor position in pixel coordinates. Alias to pos()
Returns: Mouse position in pixel coordinates
-
pixelPoint
(self) → QPoint¶ The snapped mouse cursor in pixel coordinates.
Returns: The snapped mouse cursor position in pixel coordinates.
-
setMapPoint
(self, point: QgsPointXY)¶ Set the (snapped) point this event points to in map coordinates. The point in pixel coordinates will be calculated accordingly.
Parameters: point – The point in map coordinates
-
snapPoint
(self) → QgsPointXY¶ snapPoint will snap the points using the map canvas snapping utils configuration
Note
if snapping did not succeeded, the map point will be reset to its original position
-