"reset text to style" button does not work with dynamics in inspector

• Jan 12, 2016 - 16:46
S4 - Minor

Windows version 2.02

start with empty score

1) Enter a note
2) Add a dynamic to this note i.e. p
3) Modify size of p or anything else in context menu
4) Press "reset to style" button in inspector

Nothing happens!

This command "reset to style" works correctly in the context menu.

See also



The problem comes from the fact that the SIGNAL(clicked()) of t.resetToStyle is not connected to a slot during the creation of the InspectorDynamic, after line 859 (mapSignals();) of inspector.cpp:
the instruction
connect(t.resetToStyle, SIGNAL(clicked()), SLOT(resetToStyle()));
is missing, as well as the definition of the slot Ms::InspectorDynamic::resetToStyle().
An example is shown for the inspectorText, here:
and here:

The same bug probably also affects each inspector which contains an inspectorText, such as the InspectorTempoText.

Thanks for the investigation! I was going to look at this later, and was expecting it would turn out to a problem with the implementation of the reset function, not a matter of it never getting called in the first place. Do you want to do the fix?

I could do the fix by defining a reset function for dynamics, tempotext, etc. , but maybe it would be better to unify the reset functions of these text elements to the inspectorText reset function.
The problem is that I don't know really how to do it. I tried to reference to the function of InspectorText, but I found that the prefix Ms::InspectorDynamic was automatically added in front of the function called by the slot. Maybe we could define a reset function in the InspectorDynamic which is an alias for the reset function of the InspectorText, but I don't know how this can be done.

What about moving resetToStyle from InpectorText to MuseScore::resetToStyle? It has the inspector, so it should be able to do it. Then we just need to add the connect() at the right places?

Status (old) active patch (code needs review)

Thank you lasconic, I think bringing the function to a higher level element is the key.
I moved it to the inspectorBase, from which the inspector classes are derived, and then linked the slot to the signal for the text elements I found in the code.
Proposed PR: