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