Fix clip name not showing on empty MIDI clips#8413
Conversation
Renaming never invalidated the cached pixmap, and the name text box was suppressed for beat-type clips (which is what empty clips are classified as). Call update() after setName() in changeName() and resetName(), and allow the name box on empty clips. Note: empty beat clips in the Pattern editor will now also show their name if renamed. This was not previously possible but is harmless since their default name is empty. If undesirable, the condition could be tightened by also checking the track type. Fixes LMMS#7808
|
I tested it and it works as expected.
I'm not a fan of this at all. It feels really weird that beat clips only shows their name when empty. They should either display it all the time or never, and the decision was seemingly taken to not allow them to.
The track containing I tend to like the approach of #7836 a lot more: a midi clip should be a melody clip by default when created in the song editor, and a beat clip in the pattern editor. |
| } | ||
|
|
||
| void MidiClipView::resetName() { m_clip->setName(""); } | ||
| void MidiClipView::resetName() { m_clip->setName(""); update(); } |
There was a problem hiding this comment.
Is it really useful to call update() here ?
I tested with this change reverted and haven't noticed any difference.
| RenameDialog rename_dlg( s ); | ||
| rename_dlg.exec(); | ||
| m_clip->setName( s ); | ||
| update(); |
Summary
Fixes #7808. Empty MIDI clips did not display their name for two reasons:
resetName()andchangeName()never calledupdate(), so the cached pixmap was not invalidated after renamingdrawTextBoxcondition suppressed the name text box for beat-type clips, which is how empty clips are classified (std::all_ofon an empty range returnstrue)Changes
update()aftersetName()in bothresetName()andchangeName()drawTextBoxcondition to allow the name on clips with no notesNote
Empty beat clips in the Pattern editor will now also show their name if renamed. This was not previously possible but is harmless since their default name is empty. If undesirable, the condition could be tightened by also checking the track type.
Test plan