MCPcopy Create free account
hub / github.com/Apress/modern-pyqt / mouseMoveEvent

Method mouseMoveEvent

ch03_data_visualization/data_visualization.py:41–46  ·  view source on GitHub ↗

Reimplement the mouseMoveEvent so that the user can scroll the chart area.

(self, event)

Source from the content-addressed store, hash-verified

39 self.start_pos = event.pos()
40
41 def mouseMoveEvent(self, event):
42 """Reimplement the mouseMoveEvent so that the user can scroll the chart area."""
43 if (event.buttons() == Qt.LeftButton):
44 delta = self.start_pos - event.pos()
45 self.chart.scroll(delta.x(), -delta.y())
46 self.start_pos = event.pos()
47
48 def mouseReleaseEvent(self, event):
49 self.setDragMode(QGraphicsView.NoDrag) # Don't display mouse cursor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected