fix #296171: fix triggerLayoutAll() for spanners
Fixup for 99c7b0d746
triggerLayout() and triggerLayoutAll() implementations in Element
have an optimization that allows to avoid triggering layout for
elements not yet added to a score by checking the element's parent.
This optimization is not suitable for spanners since they don't have
a parent even when added to a score. This commit adds a missing
implementation of Spanner::triggerLayoutAll() that takes this into
account.
This commit is contained in:
parent
1ee87a70b8
commit
83fe78e58a
3 changed files with 13 additions and 1 deletions
|
@ -462,7 +462,7 @@ class Element : public ScoreElement {
|
|||
}
|
||||
|
||||
virtual void triggerLayout() const;
|
||||
void triggerLayoutAll() const;
|
||||
virtual void triggerLayoutAll() const;
|
||||
virtual void drawEditMode(QPainter*, EditData&);
|
||||
|
||||
void autoplaceSegmentElement(bool above, bool add); // helper functions
|
||||
|
|
|
@ -1033,10 +1033,21 @@ void Spanner::setTicks(const Fraction& f)
|
|||
|
||||
void Spanner::triggerLayout() const
|
||||
{
|
||||
// Spanners do not have parent even when added to a score, so can't check parent here
|
||||
const int tr2 = track2() == -1 ? track() : track2();
|
||||
score()->setLayout(_tick, _tick + _ticks, staffIdx(), track2staff(tr2), this);
|
||||
}
|
||||
|
||||
void Spanner::triggerLayoutAll() const
|
||||
{
|
||||
// Spanners do not have parent even when added to a score, so can't check parent here
|
||||
score()->setLayoutAll(staffIdx(), this);
|
||||
|
||||
const int tr2 = track2();
|
||||
if (tr2 != -1 && tr2 != track())
|
||||
score()->setLayoutAll(track2staff(tr2), this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// pushUnusedSegment
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -217,6 +217,7 @@ class Spanner : public Element {
|
|||
virtual void layoutSystemsDone();
|
||||
|
||||
virtual void triggerLayout() const override;
|
||||
virtual void triggerLayoutAll() const override;
|
||||
virtual void add(Element*) override;
|
||||
virtual void remove(Element*) override;
|
||||
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
|
||||
|
|
Loading…
Reference in a new issue