Skip to content

Commit

Permalink
add proper access to stem, beam, slahbeam and hook of chords
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Mar 18, 2015
1 parent 1f260b5 commit 1a66cfb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libmscore/beam.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Beam : public Element {
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
};

Beam(Score* s);
Beam(Score* = 0);
Beam(const Beam&);
~Beam();
virtual Beam* clone() const override { return new Beam(*this); }
Expand Down
4 changes: 4 additions & 0 deletions libmscore/chord.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ enum class PlayEventType : char {
// @P graceNotes array[Ms::Chord] the list of grace note chords (read only)
// @P stem Ms::Stem the stem of the chord if any (read only)
// @P hook Ms::Hook the hook of the chord if any (read only)
// @P beam Ms::Beam the beam of the chord if any (read only)
// @P stemSlash Ms::StemSlash the stem slash of the chord (acciacatura) if any (read only)
//---------------------------------------------------------

class Chord : public ChordRest {
Expand All @@ -72,6 +74,8 @@ class Chord : public ChordRest {
Q_PROPERTY(QQmlListProperty<Ms::Chord> graceNotes READ qmlGraceNotes)
Q_PROPERTY(Ms::Hook* hook READ hook)
Q_PROPERTY(Ms::Stem* stem READ stem)
Q_PROPERTY(Ms::Beam* beam READ beam)
Q_PROPERTY(Ms::StemSlash* stemSlash READ stemSlash)

QList<Note*> _notes; // sorted to decreasing line step
LedgerLine* _ledgerLines; // single linked list
Expand Down
2 changes: 1 addition & 1 deletion libmscore/hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Hook : public Symbol {
int _hookType;

public:
Hook(Score*);
Hook(Score* = 0);
virtual Hook* clone() const override { return new Hook(*this); }
virtual qreal mag() const override { return parent()->mag(); }
virtual Element::Type type() const override { return Element::Type::HOOK; }
Expand Down
6 changes: 6 additions & 0 deletions libmscore/mscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include "mscoreview.h"
#include "plugins.h"
#include "chord.h"
#include "hook.h"
#include "stem.h"

namespace Ms {

Expand Down Expand Up @@ -327,6 +329,10 @@ QQmlEngine* MScore::qml()
qmlRegisterType<Lyrics> ("MuseScore", 1, 0, "Lyrics");
qmlRegisterType<FiguredBassItem>("MuseScore", 1, 0, "FiguredBassItem");
qmlRegisterType<LayoutBreak>("MuseScore", 1, 0, "LayoutBreak");
qmlRegisterType<Hook> ("MuseScore", 1, 0, "Hook");
qmlRegisterType<Stem> ("MuseScore", 1, 0, "Stem");
qmlRegisterType<Stem> ("MuseScore", 1, 0, "StemSlash");

This comment has been minimized.

Copy link
@Jojo-Schmitz

Jojo-Schmitz Mar 18, 2015

Contributor

Shouldn't that rather be qmlRegisterType<StemSlash> ("MuseScore", 1, 0, "StemSlash");?

qmlRegisterType<Beam> ("MuseScore", 1, 0, "Beam");

qmlRegisterUncreatableType<Element>("MuseScore", 1, 0,
"Element", tr("you cannot create an element"));
Expand Down
2 changes: 1 addition & 1 deletion libmscore/notedot.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NoteDot : public Element {
int _idx;

public:
NoteDot(Score* =0);
NoteDot(Score* = 0);
virtual NoteDot* clone() const override { return new NoteDot(*this); }
virtual Element::Type type() const override { return Element::Type::NOTEDOT; }
int idx() const { return _idx; }
Expand Down
2 changes: 1 addition & 1 deletion libmscore/stem.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Stem : public Element {
virtual void startEdit(MuseScoreView*, const QPointF&);

public:
Stem(Score*);
Stem(Score* = 0);
Stem &operator=(const Stem&) = delete;

virtual Stem* clone() const { return new Stem(*this); }
Expand Down
2 changes: 1 addition & 1 deletion libmscore/stemslash.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StemSlash : public Element {
QLineF line;

public:
StemSlash(Score* s) : Element(s) {}
StemSlash(Score* s = 0) : Element(s) {}

virtual qreal mag() const { return parent()->mag(); }
void setLine(const QLineF& l);
Expand Down

0 comments on commit 1a66cfb

Please sign in to comment.