Possibility for plugin to delete elements

• Dec 14, 2017 - 03:54
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.


Comments

Reported version 2.2 2.3
Frequency Many
Regression No
Reproducibility Always
Workaround No

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.

Reported version 2.3 2.2

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

Status PR created fixed

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._

Fix version
3.3.0