fix a minor cursor restore bug
This commit is contained in:
parent
374aabc7bf
commit
91a830e01b
@ -99,8 +99,6 @@ class Canvas(QWidget):
|
||||
"""Update line with last point and current coordinates."""
|
||||
pos = self.transformPos(ev.pos())
|
||||
|
||||
self.restoreCursor()
|
||||
|
||||
# Polygon drawing.
|
||||
if self.drawing():
|
||||
self.overrideCursor(CURSOR_DRAW)
|
||||
@ -184,6 +182,7 @@ class Canvas(QWidget):
|
||||
self.hShape.highlightClear()
|
||||
self.update()
|
||||
self.hVertex, self.hShape = None, None
|
||||
self.overrideCursor(CURSOR_DEFAULT)
|
||||
|
||||
def mousePressEvent(self, ev):
|
||||
pos = self.transformPos(ev.pos())
|
||||
@ -210,6 +209,9 @@ class Canvas(QWidget):
|
||||
self.selectedShapeCopy = None
|
||||
self.repaint()
|
||||
elif ev.button() == Qt.LeftButton and self.selectedShape:
|
||||
if self.selectedVertex():
|
||||
self.overrideCursor(CURSOR_POINT)
|
||||
else:
|
||||
self.overrideCursor(CURSOR_GRAB)
|
||||
elif ev.button() == Qt.LeftButton:
|
||||
pos = self.transformPos(ev.pos())
|
||||
@ -640,10 +642,18 @@ class Canvas(QWidget):
|
||||
self.visible[shape] = value
|
||||
self.repaint()
|
||||
|
||||
def currentCursor(self):
|
||||
cursor = QApplication.overrideCursor()
|
||||
if cursor is not None:
|
||||
cursor = cursor.shape()
|
||||
return cursor
|
||||
|
||||
def overrideCursor(self, cursor):
|
||||
self.restoreCursor()
|
||||
self._cursor = cursor
|
||||
if self.currentCursor() is None:
|
||||
QApplication.setOverrideCursor(cursor)
|
||||
else:
|
||||
QApplication.changeOverrideCursor(cursor)
|
||||
|
||||
def restoreCursor(self):
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user