Skip to content

Commit

Permalink
Add ability to get path to a score to plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstrema authored and vpereverzev committed Dec 14, 2020
1 parent 01eaed2 commit 0e396f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mscore/plugin/api/score.h
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

0 comments on commit 0e396f0

Please sign in to comment.