Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get path to a score from plugins #7083

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mscore/plugin/api/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ class Score : public Ms::PluginAPI::ScoreElement {
*/
Q_PROPERTY(QQmlListProperty<Ms::PluginAPI::Staff> staves READ staves)

/**
* Returns the path to the file from which the score was imported, or empty.
* \warning If the score hasn't been saved yet, this will return an empty string.
* \since MuseScore 3.6
*/
Q_PROPERTY(QString path READ path)


public:
/// \cond MS_INTERNAL
Score(Ms::Score* s = nullptr, Ownership o = Ownership::SCORE)
Expand All @@ -136,6 +144,7 @@ class Score : public Ms::PluginAPI::ScoreElement {
QString title() { return score()->metaTag("workTitle"); }
Ms::PluginAPI::Selection* selection() { return selectionWrap(&score()->selection()); }
MStyle* style() { return wrap(&score()->style(), score()); }
QString path() { return score()->importedFilePath(); }

int pageNumberOffset() const { return score()->pageNumberOffset(); }
void setPageNumberOffset(int offset) { score()->undoChangePageNumberOffset(offset); }
Expand Down