Browse Source

streamline mousewheel behaviour in song editor

master
Nils 2 years ago
parent
commit
2b5315460a
  1. 18
      qtgui/songeditor.py

18
qtgui/songeditor.py

@ -645,23 +645,35 @@ class Switch(QtWidgets.QGraphicsRectItem):
def wheelEvent(self, event):
"""Does not get triggered when switch is off.
This buffers until hoverLeaveEvent and then the new value is sent in self.hoverLeaveEvent"""
event.accept()
This buffers until hoverLeaveEvent and then the new value is sent in self.hoverLeaveEvent
We want to keep normal scrolling with the mousewheel, therefore both transpose functions
need an additional key. Otherwise we get scroll on measures that are off and transpose
on measures that are active, which is very confusing.
"""
if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier: #half tone transposition
event.accept()
if event.delta() > 0:
self._bufferHalftoneTranspose = min(+24, self._bufferHalftoneTranspose+1)
else:
self._bufferHalftoneTranspose = max(-24, self._bufferHalftoneTranspose-1)
self._setHalftoneTransposeLabel(self._bufferHalftoneTranspose)
else: #scale transposition
elif QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.AltModifier: #scale transposition
event.accept()
if event.delta() > 0:
self._bufferScaleTranspose = min(+7, self._bufferScaleTranspose+1)
else:
self._bufferScaleTranspose = max(-7, self._bufferScaleTranspose-1)
self._setScaleTransposeLabel(self._bufferScaleTranspose)
else: #normal scroll or zoom.
event.ignore()
#super.wheelEvent(event)
class TrackLabelEditor(QtWidgets.QGraphicsScene):
"""Only the track labels"""
def __init__(self, parentView):

Loading…
Cancel
Save