MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

Fix #20547: Staff creation when instrument is selected

Open SalvadorCorreia opened this issue 1 year ago • 3 comments

Previously, when adding a new staff under a selected instrument, it was created as non-selected. This caused confusion, particularly when hiding staffs, as selected staffs affected the newly created one, but not vice versa. To resolve this issue, I have updated the behavior so that a newly created staff is automatically selected if the instrument it is created for is selected. This ensures consistency and clarity in managing staffs, addressing the confusion experienced by users.

Resolves: #20547

  • [x] I signed the CLA
  • [x] The title of the PR describes the problem it addresses
  • [x] Each commit's message describes its purpose and effects, and references the issue it resolves
  • [x] If changes are extensive, there is a sequence of easily reviewable commits
  • [x] The code in the PR follows the coding rules
  • [x] There are no unnecessary changes
  • [x] The code compiles and runs on my machine, preferably after each commit individually
  • [ ] I created a unit test or vtest to verify the changes I made (if applicable)

SalvadorCorreia avatar Apr 05 '24 13:04 SalvadorCorreia

Judging from AbstractInstrumentsPanelTreeItem::setIsSelected, we should perhaps go for a more general solution. What if you move this new code to AbstractInstrumentsPanelTreeItem::appendChild and AbstractInstrumentsPanelTreeItem::insertChild?

Of course, you can't literally move the code, because then it does the wrong thing... but you get the idea.

cbjeukendrup avatar Apr 06 '24 15:04 cbjeukendrup

Yes, I also think we should take a more general solution. This should probably be the case, if the user adds a new staff or creates linked staff, then we should select the new item and deselect all other items.

Eism avatar Apr 08 '24 13:04 Eism

I have currently followed @cbjeukendrup's instructions and believe to have made my solution more general.

SalvadorCorreia avatar May 01 '24 15:05 SalvadorCorreia

Tested on MacOS 14, Windows 11, Ubuntu 22.04.3. Approved https://github.com/musescore/MuseScore/issues/20547 FIXED

zacjansheski avatar May 02 '24 21:05 zacjansheski