musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.11k stars 2.62k forks source link

Properties: need to press "undo" twice to undo "reset to default" for compound properties like align and scale #15765

Open cbjeukendrup opened 1 year ago

cbjeukendrup commented 1 year ago

To Reproduce Steps to reproduce the behavior:

  1. Create score
  2. Add time signature
  3. Change its scale in the Properties panel; modify both horizontal and vertical scale.
  4. Click '...' > "reset to default".
  5. Press undo -> expected: both horizontal and vertical scale are back at their customised value -> actual: only vertical scale is restored; horizontal scale is still at 100%
  6. Press undo again -> now horizontal scale is also back at its customised value

Same story for the "align" property of text.

Expected behavior Since it takes one action to reset both values, it should take one press of the "undo" button to undo that.

Screenshots If applicable, add screenshots to help explain your problem.

https://user-images.githubusercontent.com/48658420/211215506-20596709-b9c2-4721-a56f-8da3d8f1ca73.mov

Tejkh1 commented 1 year ago

Can you please suggest the file, which I should see.

cbjeukendrup commented 1 year ago

@Tejkh1 For example, in the case of the Align property, this is the source of the problem: https://github.com/musescore/MuseScore/blob/43daf47bfde6b00ca598154114f75191220a6dd0/src/inspector/view/qml/MuseScore/Inspector/text/TextInspectorView.qml#L171-L176 "Reset to default" is called for both property items individually, which results in two separate "undoable actions" in the C++ code which is called eventually as a result, namely https://github.com/musescore/MuseScore/blob/43daf47bfde6b00ca598154114f75191220a6dd0/src/inspector/models/abstractinspectormodel.cpp#L271-L296 because for each call individually, the code is surrounded by beginCommand()/endCommand().

So, it is quite easy to see what's the problem, but seeing a proper solution may be a bit more challenging!