Browse Source

Set selection z factor to a high value, stretchX selection

master
Nils 4 years ago
parent
commit
3aa361910c
  1. 12
      qtgui/cursor.py
  2. 1
      qtgui/scorescene.py

12
qtgui/cursor.py

@ -149,7 +149,7 @@ class Playhead(QtWidgets.QGraphicsLineItem):
self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable)
self.setCursor(QtCore.Qt.SizeHorCursor)
self.setAcceptedMouseButtons(QtCore.Qt.LeftButton)
self.setZValue(90)
self.setZValue(90) #This is relative to the parent, which is the scene.
#self.parentScoreScene.parentView.verticalScrollBar().valueChanged.connect(self.setLineToWindowHeigth)
#self.hide()
#self.maxHeight = QtWidgets.QDesktopWidget().geometry().height() #we really hope the screen resolution does not change during the session.
@ -226,15 +226,25 @@ class Selection(QtWidgets.QGraphicsRectItem):
self.invalidBrush = QtGui.QBrush(QtGui.QColor("grey"))
self.invalidBrush.setStyle(QtCore.Qt.DiagCrossPattern)
self._tupleOfCursorExportObjects = None #cache for stretchX
self.setPen(pen)
self.setOpacity(0.2)
self.setZValue(95) #Below playback cursor, but pretty high. This is relative to the parent, which is the scene.
self.setEnabled(False)
api.callbacks.setSelection.append(self.setSelection)
def boundingRect(self, *args):
return oneRectToReturnThemAll
def stretchXCoordinates(self, factor):
"""Reposition the items on the X axis.
Call goes through all parents/children, starting from ScoreView._stretchXCoordinates.
Docstring there."""
self.setSelection(self._tupleOfCursorExportObjects)
def setSelection(self, tupleOfCursorExportObjects):
self._tupleOfCursorExportObjects = tupleOfCursorExportObjects
if tupleOfCursorExportObjects:
validSelection, topleftCursorObject, bottomRightCursorObject = tupleOfCursorExportObjects
if validSelection:

1
qtgui/scorescene.py

@ -314,6 +314,7 @@ class GuiScore(QtWidgets.QGraphicsScene):
self.conductor.stretchXCoordinates(factor)
self.cursor.setX(self.cursor.pos().x() * factor)
self.playhead.setX(self.playhead.pos().x() * factor)
self.selection.stretchXCoordinates(factor)
for track in self.tracks.values():
track.stretchXCoordinates(factor)

Loading…
Cancel
Save