mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] Fix picking point from map always triggers a release
event for previous map tool
This commit is contained in:
parent
6efcc2fe86
commit
506f6d40b7
@ -25,13 +25,15 @@ __copyright__ = '(C) 2016, Alexander Bruy'
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
from qgis.PyQt.QtCore import Qt
|
||||
from qgis.PyQt.QtCore import Qt, pyqtSignal
|
||||
|
||||
from qgis.gui import QgsMapToolEmitPoint
|
||||
|
||||
|
||||
class PointMapTool(QgsMapToolEmitPoint):
|
||||
|
||||
complete = pyqtSignal()
|
||||
|
||||
def __init__(self, canvas):
|
||||
QgsMapToolEmitPoint.__init__(self, canvas)
|
||||
|
||||
@ -41,6 +43,5 @@ class PointMapTool(QgsMapToolEmitPoint):
|
||||
def activate(self):
|
||||
self.canvas.setCursor(self.cursor)
|
||||
|
||||
def canvasPressEvent(self, event):
|
||||
pnt = self.toMapCoordinates(event.pos())
|
||||
self.canvasClicked.emit(pnt, event.button())
|
||||
def canvasReleaseEvent(self, event):
|
||||
self.complete.emit()
|
||||
|
@ -59,6 +59,7 @@ class PointSelectionPanel(BASE, WIDGET):
|
||||
|
||||
self.tool = PointMapTool(canvas)
|
||||
self.tool.canvasClicked.connect(self.updatePoint)
|
||||
self.tool.complete.connect(self.pointPicked)
|
||||
else:
|
||||
self.prevMapTool = None
|
||||
self.tool = None
|
||||
@ -81,8 +82,9 @@ class PointSelectionPanel(BASE, WIDGET):
|
||||
def updatePoint(self, point, button):
|
||||
s = '{},{}'.format(point.x(), point.y())
|
||||
self.crs = QgsProject.instance().crs()
|
||||
|
||||
self.leText.setText(s)
|
||||
|
||||
def pointPicked(self):
|
||||
canvas = iface.mapCanvas()
|
||||
canvas.setMapTool(self.prevMapTool)
|
||||
self.dialog.showNormal()
|
||||
|
Loading…
x
Reference in New Issue
Block a user