本文整理汇总了C++中Articulation::setTrack方法的典型用法代码示例。如果您正苦于以下问题:C++ Articulation::setTrack方法的具体用法?C++ Articulation::setTrack怎么用?C++ Articulation::setTrack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articulation
的用法示例。
在下文中一共展示了Articulation::setTrack方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DurationElement
ChordRest::ChordRest(const ChordRest& cr, bool link)
: DurationElement(cr)
{
_durationType = cr._durationType;
_staffMove = cr._staffMove;
_beam = 0;
_tabDur = 0; // tab sur. symb. depends upon context: can't be
// simply copied from another CR
for (Articulation* a : cr._articulations) { // make deep copy
Articulation* na = new Articulation(*a);
if (link)
na->linkTo(a);
na->setParent(this);
na->setTrack(track());
_articulations.append(na);
}
_beamMode = cr._beamMode;
_up = cr._up;
_small = cr._small;
_crossMeasure = cr._crossMeasure;
_space = cr._space;
for (Lyrics* l : cr._lyricsList) { // make deep copy
if (l == 0)
continue;
Lyrics* nl = new Lyrics(*l);
if (link)
nl->linkTo(l);
nl->setParent(this);
nl->setTrack(track());
_lyricsList.append(nl);
}
}
示例2: drop
Element* BarLine::drop(const DropData& data)
{
Element* e = data.element;
int type = e->type();
if (type == BAR_LINE) {
BarLine* bl = static_cast<BarLine*>(e);
BarLineType st = bl->subtype();
if (st == subtype()) {
delete e;
return 0;
}
Measure* m = segment()->measure();
if (st == START_REPEAT) {
m = m->nextMeasure();
if (m == 0) {
delete e;
return 0;
}
}
m->drop(data);
}
else if (type == ARTICULATION) {
Articulation* atr = static_cast<Articulation*>(e);
atr->setParent(this);
atr->setTrack(track());
score()->select(atr, SELECT_SINGLE, 0);
score()->undoAddElement(atr);
}
return 0;
}
示例3: grace
void TestNote::grace()
{
Score* score = readScore(DIR + "grace.mscx");
score->doLayout();
Chord* chord = score->firstMeasure()->findChord(0, 0);
Note* note = chord->upNote();
// create
score->setGraceNote(chord, note->pitch(), NoteType::APPOGGIATURA, MScore::division/2);
Chord* gc = chord->graceNotes().first();
Note* gn = gc->notes().first();
// Note* n = static_cast<Note*>(writeReadElement(gn));
// QCOMPARE(n->noteType(), NoteType::APPOGGIATURA);
// delete n;
// tie
score->startCmd();
score->select(gn);
score->cmdAddTie();
score->endCmd();
// n = static_cast<Note*>(writeReadElement(gn));
// QVERIFY(n->tieFor() != 0);
// delete n;
// tremolo
score->startCmd();
Tremolo* tr = new Tremolo(score);
tr->setTremoloType(TremoloType::R16);
tr->setParent(gc);
tr->setTrack(gc->track());
score->undoAddElement(tr);
score->endCmd();
// Chord* c = static_cast<Chord*>(writeReadElement(gc));
// QVERIFY(c->tremolo() != 0);
// delete c;
// articulation
score->startCmd();
Articulation* ar = new Articulation(score);
ar->setArticulationType(ArticulationType::Sforzatoaccent);
ar->setParent(gc);
ar->setTrack(gc->track());
score->undoAddElement(ar);
score->endCmd();
// c = static_cast<Chord*>(writeReadElement(gc));
// QVERIFY(c->articulations().size() == 1);
// delete c;
QVERIFY(saveCompareScore(score, "grace-test.mscx", DIR + "grace-ref.mscx"));
}
示例4: drop
Element* BarLine::drop(const DropData& data)
{
Element* e = data.element;
int type = e->type();
if (type == BAR_LINE) {
BarLine* bl = static_cast<BarLine*>(e);
BarLineType st = bl->barLineType();
// if no change in subtype or no change in span, do nothing
if (st == barLineType() && bl->spanFrom() == 0 && bl->spanTo() == DEFAULT_BARLINE_TO) {
delete e;
return 0;
}
// system left-side bar line
if (parent()->type() == SYSTEM) {
BarLine* b = static_cast<System*>(parent())->barLine();
score()->undoChangeProperty(b, P_SUBTYPE, int(bl->barLineType()));
delete e;
return 0;
}
// check if the new property can apply to this single bar line
bool oldRepeat = (barLineType() == START_REPEAT || barLineType() == END_REPEAT
|| barLineType() == END_START_REPEAT);
bool newRepeat = (bl->barLineType() == START_REPEAT || bl->barLineType() == END_REPEAT
|| bl->barLineType() == END_START_REPEAT);
// if repeats are not involved or drop refers to span rather than subtype =>
// single bar line drop
if( (!oldRepeat && !newRepeat) || (bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) ) {
// if drop refers to span, update this bar line span
if(bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) {
// if dropped spanFrom or spanTo are below the middle of standard staff (5 lines)
// adjust to the number of syaff lines
int bottomSpan = (staff()->lines()-1) * 2;
int spanFrom = bl->spanFrom() > 4 ? bottomSpan - (8 - bl->spanFrom()) : bl->spanFrom();
int spanTo = bl->spanTo() > 4 ? bottomSpan - (8 - bl->spanTo()) : bl->spanTo();
score()->undoChangeSingleBarLineSpan(this, 1, spanFrom, spanTo);
}
// if drop refer to subtype, update this bar line subtype
else {
score()->undoChangeProperty(this, P_SUBTYPE, int(bl->barLineType()));
// setCustomSubtype(true);
}
delete e;
return 0;
}
// drop applies to all bar lines of the measure
Measure* m = static_cast<Segment*>(parent())->measure();
if (st == START_REPEAT) {
m = m->nextMeasure();
if (m == 0) {
delete e;
return 0;
}
}
m->drop(data);
}
else if (type == ARTICULATION) {
Articulation* atr = static_cast<Articulation*>(e);
atr->setParent(this);
atr->setTrack(track());
score()->undoAddElement(atr);
return atr;
}
return 0;
}
示例5: readProperties
bool ChordRest::readProperties(XmlReader& e)
{
const QStringRef& tag(e.name());
if (tag == "durationType") {
setDurationType(e.readElementText());
if (actualDurationType().type() != TDuration::DurationType::V_MEASURE) {
if ((type() == Element::Type::REST) &&
// for backward compatibility, convert V_WHOLE rests to V_MEASURE
// if long enough to fill a measure.
// OTOH, freshly created (un-initialized) rests have numerator == 0 (< 4/4)
// (see Fraction() constructor in fraction.h; this happens for instance
// when pasting selection from clipboard): they should not be converted
duration().numerator() != 0 &&
// rest durations are initialized to full measure duration when
// created upon reading the <Rest> tag (see Measure::read() )
// so a V_WHOLE rest in a measure of 4/4 or less => V_MEASURE
(actualDurationType()==TDuration::DurationType::V_WHOLE && duration() <= Fraction(4, 4)) ) {
// old pre 2.0 scores: convert
setDurationType(TDuration::DurationType::V_MEASURE);
}
else // not from old score: set duration fraction from duration type
setDuration(actualDurationType().fraction());
}
else {
if (score()->mscVersion() < 115) {
SigEvent event = score()->sigmap()->timesig(e.tick());
setDuration(event.timesig());
}
}
}
else if (tag == "BeamMode") {
QString val(e.readElementText());
Beam::Mode bm = Beam::Mode::AUTO;
if (val == "auto")
bm = Beam::Mode::AUTO;
else if (val == "begin")
bm = Beam::Mode::BEGIN;
else if (val == "mid")
bm = Beam::Mode::MID;
else if (val == "end")
bm = Beam::Mode::END;
else if (val == "no")
bm = Beam::Mode::NONE;
else if (val == "begin32")
bm = Beam::Mode::BEGIN32;
else if (val == "begin64")
bm = Beam::Mode::BEGIN64;
else
bm = Beam::Mode(val.toInt());
_beamMode = Beam::Mode(bm);
}
else if (tag == "Attribute" || tag == "Articulation") { // obsolete: "Attribute"
Articulation* atr = new Articulation(score());
atr->setTrack(track());
atr->read(e);
add(atr);
}
else if (tag == "leadingSpace") {
qDebug("ChordRest: leadingSpace obsolete"); // _extraLeadingSpace = Spatium(val.toDouble());
e.skipCurrentElement();
}
else if (tag == "trailingSpace") {
qDebug("ChordRest: trailingSpace obsolete"); // _extraTrailingSpace = Spatium(val.toDouble());
e.skipCurrentElement();
}
else if (tag == "Beam") {
int id = e.readInt();
Beam* beam = e.findBeam(id);
if (beam)
beam->add(this); // also calls this->setBeam(beam)
else
qDebug("Beam id %d not found", id);
}
else if (tag == "small")
_small = e.readInt();
else if (tag == "duration")
setDuration(e.readFraction());
else if (tag == "ticklen") { // obsolete (version < 1.12)
int mticks = score()->sigmap()->timesig(e.tick()).timesig().ticks();
int i = e.readInt();
if (i == 0)
i = mticks;
if ((type() == Element::Type::REST) && (mticks == i)) {
setDurationType(TDuration::DurationType::V_MEASURE);
setDuration(Fraction::fromTicks(i));
}
else {
Fraction f = Fraction::fromTicks(i);
setDuration(f);
setDurationType(TDuration(f));
}
}
else if (tag == "dots")
setDots(e.readInt());
else if (tag == "move")
_staffMove = e.readInt();
else if (tag == "Slur") {
int id = e.intAttribute("id");
if (id == 0)
//.........这里部分代码省略.........