Possibility for plugin to delete elements
Type
Plugins
Frequency
Many
Severity
S5 - Suggestion
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project
Context :
I'm working on a plugin that adds tablature to accordions. The plugin can add the text under each notes, but if I change some notes, I can't run the plugin again to update the text because it can't delete/replace the existing ones.
Possible solution:
In libmscore/segment.h, we could expose the function removeAnnotation(Element* e)
This way, we could do: cursor.remove(element)
I tried It and it works, but the actual function doesn't support Undo, which brings another problem.
Fix version
3.3.0
Comments
I am struggling with the same issue. My plugin to add accordion tablature works but when you run it on a score that already contains tablature markings, it adds new 'staff text' elements that overwrite the existing tablature without a possibility to remove the existing tablature.
Is there a way to edit or delete existing elements from a plugin? If not, can it be made available.
Sure not for any 2.x version as there won't be further updates, so if any, then for 3.0. But that needs the entire plugin infrastructure fixed first
This pull request includes also a solution for this issue:
https://github.com/musescore/MuseScore/pull/5209
Fixed in branch master, commit 19677e3876
_Fix #291790, fix #267604: Restore Chord.remove() and Chord.add() methods.
Restore the add and remove QML methods for the
Chord object. Adds exposed Element.parent property.
These existed in v2.x. Finally it adds a removeElement
method to PluginAPI for general element disposal._
Automatically closed -- issue fixed for 2 weeks with no activity.