Remove elements from score using plugin code?

• Apr 18, 2015 - 02:37

The Chord element has a remove(element) function. Would it be possible to include a remove(element) function for other elements, such as the Score element, or Segment element? I'm working on a notehead note name plugin, and right now, the only way to clear the added noteheads (I'm using StaffText elements) is to select similar elements in MS, and then cut. Would be nice to be able to do this from within the plugin (I've seen similar requests for the notenames plugin).


+1 for the request.

Some thoughts on that:

I don't think using Chord.remove() is a good idea. It's a low-level function, which doesn't use the undo-system and I just crashed MuseScore using it. It probably shouldn't be accessible for plugins.

On the other hand, half a year ago I opened a pull request (#1264), which takes care of some possible crashes and also added Cursor.remove(Element) which would allow to remove a StaffText element as well.

So we might already have the functionality you're requesting, or at least a part of it, there.

Do you still have an unanswered question? Please log in first to post your question.