Skip to content
Snippets Groups Projects
Commit b969cb46 authored by SeeLook's avatar SeeLook
Browse files

Added helper methods for creating Trhythm and Tnote(Tnote, Trhythm) instances

parent 7f979d52
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ TnootkaQML::TnootkaQML(QObject* parent) :
qRegisterMetaType<Tmeter>();
qmlRegisterUncreatableType<Tmeter>("Score", 1, 0, "Tmeter", QStringLiteral("You cannot create an instance of the Tmeter."));
qmlRegisterUncreatableType<Trhythm>("Score", 1, 0, "Trhythm", QStringLiteral("You cannot create an instance of the Trhythm."));
qRegisterMetaType<Trhythm>();
qmlRegisterType<TscoreObject>("Score", 1, 0, "TscoreObject");
qmlRegisterType<TstaffObject>("Score", 1, 0, "TstaffObject");
......@@ -112,6 +113,17 @@ Tnote TnootkaQML::note(const Tnote& n, int rhythm, bool rest, bool dot) {
}
Tnote TnootkaQML::note(const Tnote& n, const Trhythm& r) {
return Tnote(n, r);
}
Trhythm TnootkaQML::rhythm(int rtm, bool rest, bool dot, bool triplet) {
return Trhythm(static_cast<Trhythm::Erhythm>(rtm), rest, dot, triplet);
}
QString TnootkaQML::noteName(const Tnote& n, int style, bool showOctave) {
// Tnote::toText() method returns only names in user preferred according to settings
// To cheat it and force note name in any given style we are resetting pointer of is7th_B
......
......@@ -66,6 +66,8 @@ public:
Q_INVOKABLE Tmeter meter(int m);
Q_INVOKABLE Tnote note(int pitch, int octave, int alter, int rhythm = 3, bool rest = false, bool dot = false);
Q_INVOKABLE Tnote note(const Tnote& n, int rhythm = 3, bool rest = false, bool dot = false);
Q_INVOKABLE Tnote note(const Tnote& n, const Trhythm& r);
Q_INVOKABLE Trhythm rhythm(int rtm, bool rest, bool dot, bool triplet);
Q_INVOKABLE QString noteName(const Tnote& n, int style, bool showOctave = true);
Q_INVOKABLE QString majorKeyName(int key);
Q_INVOKABLE QString minorKeyName(int key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment