"New Layout Code" Clarification
Would someone be kind enough to explain the impetus behind the new layout code for MuseScore 3?
I've been looking at a bug that affects adding Staff Text to MM rests. I believe there is a commonality in the cause of several MM rest related bugs. It seems that, in this instance, an error is occurring when a reference to a QList element is out-of-bounds. What I've noticed is a distinct change to the implementation of the curLine method(s). It's hard to pinpoint why the cursor call approach used in 2.2.1 is no longer needed or used. I sense it is impacting the aforementioned functionality (based on stack trace).
I can explain the impetus but for the details, I will forward your question to Werner, the lead dev.
In 2.x, if you change a note pitch, add a staccato or do any action on a score, the whole score needs to be relayouted. If your score is large and your CPU is weak, just changing a pitch can take several seconds. In MuseScore 3, it's being changed so MuseScore only layout the music up to where it's needed. At the same time, MuseScore 2 layout didn't do any anti collision detection, MuseScore 3 tries to do that.
I am not sure i understand what you are asking. The layout code had to be changed to implement the partial layout functionality to speed things up for larger scores. The implementation of Text() has changed bc. dependencies for some Qt classes are removed. This was done in the hope of getting rid of some long standing problems. Text is work in progress. Especially the implementation of text editing is not complete.
In reply to I am not sure i understand… by [DELETED] 3
Please see my comment to Marc Sabatella. I'm hoping you can provide input on my findings.
It would also help if you explained which bug you are working on - we might be able to better understand the context and provide better guidance.
In reply to It would also help if you… by Marc Sabatella
I'm working on issue #251451: Crash when trying to add staff text to multimeasure rests
I was able to narrow the particular issue down to an invalid QList element request (size of the list was 0, yet an element was being requested from it). I was able to silence the bug by "hacking" the request with an append to the QList immediately prior to the request. Though I "fixed" the bug, adding staff text to MM rests still isn't possible in version MuseScore 3.0 . It allows me to type staff text, but it is cut-off, appearing almost off the page at the top of the document, while typing. After clicking away from the staff to exit the text-edit mode, the text doesn't relocate to the top of the staff (or persist, for that matter).
I don't know enough about what the final flow of control is supposed to look like in the code, so I don't know which responsibilities to assign where (for example where the QList _layout is supposed to be initialized with at least one element before being referenced).
I found the issue in the curLine() function in Text.cpp
I also noticed an issue where the style elements for adding staff text is missing in Style.cpp
I'd be interested in going further with this, but would appreciate any advice or mentorship that you are willing to offer.
In reply to I'm working on issue #251451… by MrDrProfK
Looking closer at the code i see several problems: StaffText() must be layouted before startEdit() can be called on it. This fixes the crash. Then there is a problem with mm rests. For mm rests there are two text elements which must be synchronized which does not work right.