Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #290053: don't trigger layout for elements not yet added to score #5092

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

MarcSabatella
Copy link
Contributor

See https://musescore.org/en/node/290053

Currently, adding an element to the score often causes a layout of the whole score from the start to that point. That's because the act of constructing the new element often involves some setProperty() calls, and Eement::setProperty() as well as many of its overrides call triggerLayout(). That would be fine, but the element being constructed does not yet have a parent, so when triggerLayout() goes to get a tick, it comes up with 0. Thus, we end up setting the start tick for the layout range to 0 unnecessarily. The result is that adding elements to the score gets progressively slower the deeper into the score you go.

My PR here is very simple, I simply have triggerLayout() do nothing for elements with no parent. Once the element is fully constructed, and given a parent, there is an explicit triggerLayout() call right at the top of Score::addElement() as well, so that we are able to set the correct tick and perform the proper layout.

@dmitrio95 dmitrio95 merged commit 4c15b4e into musescore:master Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants