MCPcopy Create free account
hub / github.com/PyQt5/PyQt / mouseMoveEvent

Method mouseMoveEvent

QPainter/Draw.py:46–62  ·  view source on GitHub ↗
(self, ev)

Source from the content-addressed store, hash-verified

44 self.update()
45
46 def mouseMoveEvent(self, ev):
47 if self.drawEnable:
48 def in_end_range(curr, first):
49 return first.x() - 5 <= curr.x() <= first.x() + 5 and first.y() - 5 <= curr.y() <= first.y() + 5
50
51 if len(self.current_points) > 0 and in_end_range(ev.pos(), self.current_points[0]):
52 self.current_points.append(self.current_points[0])
53 self.points.append(self.current_points)
54 self.current_points = []
55 else:
56 self.current_points.append(ev.pos())
57 elif len(self.current_points) > 0:
58 self.current_points.append(ev.pos())
59 self.points.append(self.current_points)
60 self.current_points = []
61
62 self.update()
63
64 def mousePressEvent(self, ev):
65 if Qt.LeftButton & ev.button():

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected