From dc62913e38b0abbc6316d4e720b03b21dc32b336 Mon Sep 17 00:00:00 2001 From: Nils <> Date: Wed, 30 Jun 2021 18:26:35 +0200 Subject: [PATCH] Adjust GUI group rectangle after number of measures changed --- engine/api.py | 3 +++ qtgui/songeditor.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/engine/api.py b/engine/api.py index 1683f3b..7c1e8cb 100644 --- a/engine/api.py +++ b/engine/api.py @@ -215,6 +215,8 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks callbacks._dataChanged() def _numberOfMeasuresChanged(self): + """The whole song got longer or shorter. + Number of measures is the same for all tracks.""" export = session.data.export() for func in self.numberOfMeasuresChanged: func(export) @@ -228,6 +230,7 @@ class ClientCallbacks(Callbacks): #inherits from the templates api callbacks callbacks._dataChanged() def _swingChanged(self): + """Global for the whole song""" export = session.data.swing for func in self.swingChanged: func(export) diff --git a/qtgui/songeditor.py b/qtgui/songeditor.py index e8cd260..fbb6689 100644 --- a/qtgui/songeditor.py +++ b/qtgui/songeditor.py @@ -196,6 +196,13 @@ class SongEditor(QtWidgets.QGraphicsScene): for l in self.barlines[requestAmountOfMeasures:]: l.hide() + #Adjust Group Header Rectangles + for groupRect in self._groupRectangles: + r = groupRect.rect() + r.setWidth((requestAmountOfMeasures-1) * SIZE_UNIT) + groupRect.setRect(r) + + #Guaranteed visible. for l in self.barlines[:requestAmountOfMeasures]: l.show()