Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ RELEASING:
- Delete annotations when plugin is uninstalled ([#346](https://github.com/GIScience/orstools-qgis-plugin/issues/346))
- Reset hand cursor after deactivating line tool ([#342](https://github.com/GIScience/orstools-qgis-plugin/issues/342))

## Added
- Improve cursor behaviour during digitization

## [2.0.1] - 2025-06-01
### Added
- Readd old icons and add new icons for processing algorithms
Expand Down
18 changes: 8 additions & 10 deletions ORStools/utils/maptools.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
from qgis.PyQt import QtCore
from qgis.PyQt.QtCore import Qt, pyqtSignal, QEvent
from qgis.PyQt.QtGui import QColor, QMouseEvent
from qgis.PyQt.QtWidgets import (
QApplication,
)

from ORStools import ROUTE_COLOR
from ORStools.utils import transform, router
Expand Down Expand Up @@ -106,10 +103,12 @@ def deactivate(self):
# Thus, we only change restore the Cursor once we are not dragging the annotation anymore.
def canvasMoveEvent(self, e: QEvent) -> None:
hovering = self.check_annotation_hover(e.pos())
if hovering and not QApplication.overrideCursor() == QtCore.Qt.CursorShape.OpenHandCursor:
QApplication.setOverrideCursor(QtCore.Qt.CursorShape.OpenHandCursor)
elif not hovering and not self.dragging_vertex:
QApplication.restoreOverrideCursor()
if hovering:
self.setCursor(QtCore.Qt.CursorShape.OpenHandCursor)
elif not self.dragging_vertex and self.dlg.isVisible():
self.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
elif not self.dragging_vertex:
self.setCursor(QtCore.Qt.CursorShape.CrossCursor)

def check_annotation_hover(self, pos: QMouseEvent) -> int:
click = [pos.x(), pos.y()]
Expand Down Expand Up @@ -161,7 +160,7 @@ def canvasPressEvent(self, event: QEvent) -> None:
if hovering:
# clicking should only change the cursor if it is hovering over an annotation.
# The corresponding reset happens in the release event.
QApplication.setOverrideCursor(QtCore.Qt.CursorShape.ClosedHandCursor)
self.setCursor(QtCore.Qt.CursorShape.ClosedHandCursor)
if self.dlg.rubber_band:
self.dlg.rubber_band.reset()
self.move_i = self.dlg.annotations.index(hovering)
Expand All @@ -172,15 +171,14 @@ def canvasPressEvent(self, event: QEvent) -> None:

def canvasReleaseEvent(self, event: QEvent) -> None:
if event.button() == Qt.MouseButton.RightButton:
QApplication.restoreOverrideCursor()
self.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
self.dlg.show()
return

point = self.toMapCoordinates(event.pos())
self.points.append(point)

if self.dragging_vertex:
QApplication.restoreOverrideCursor()
self.dragging_vertex = False

try:
Expand Down