Expose FretDiagram setDot/setMarker/setBarre to plugin API#32848
Open
dheerajchand wants to merge 1 commit intomusescore:masterfrom
Open
Expose FretDiagram setDot/setMarker/setBarre to plugin API#32848dheerajchand wants to merge 1 commit intomusescore:masterfrom
dheerajchand wants to merge 1 commit intomusescore:masterfrom
Conversation
Add a FretDiagram wrapper class to the QML plugin API that exposes the methods needed to programmatically set dots, markers (open/muted), and barres on fretboard diagrams from plugins. New Q_INVOKABLE methods: - setDot(string, fret, add, dotType) — place a dot on a string/fret - setMarker(string, markerType) — set open (O) or muted (X) marker - setBarre(startString, endString, fret) — create a barre - clear() — remove all dots/markers/barres New Q_PROPERTY accessors: - strings (read/write) — number of strings - frets (read/write) — number of visible frets - fretOffset (read/write) — starting fret position - showNut (read/write) — toggle nut display This follows the same wrapper pattern used by Note, Chord, Lyrics, and other existing API wrapper classes. The wrapper delegates to the existing FretDiagram dom class methods which already handle all the internal logic. Fixes musescore#32798
92e81f7 to
bf1831a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
FretDiagramwrapper class to the QML plugin API that exposes the methods needed to programmatically set dots, markers, and barres on fretboard diagrams from plugins.Currently, plugins can create a
FretDiagramelement and set its grid properties (fretStrings,fretFrets,fretOffset), but cannot set individual dot positions, open/muted markers, or barres. This makes it impossible to insert complete fretboard diagrams from a plugin — only empty grids.Changes
src/engraving/api/v1/elements.h:#include "engraving/dom/fret.h"FretDiagramwrapper class inheriting fromEngravingItemQ_INVOKABLEmethods:setDot(),setMarker(),setBarre(),clear()Q_PROPERTYaccessors:strings,frets,fretOffset,showNutsrc/engraving/api/v1/elements.cpp:API_WRAP(FretDiagram)to thewrap()functionPlugin usage after this change
Context
This resolves #32798. The
FretDiagramdom class already has fullsetDot(),setMarker(), andsetBarre()implementations — they just aren't exposed to the QML plugin API. This PR follows the exact same wrapper pattern used byNote,Chord,Lyrics, and other existing API wrapper classes.The Chord Library plugin is a concrete use case — it provides a searchable jazz guitar voicing library but currently can only insert empty grids because of this limitation.