本文整理汇总了C++中MasterScore::undoStack方法的典型用法代码示例。如果您正苦于以下问题:C++ MasterScore::undoStack方法的具体用法?C++ MasterScore::undoStack怎么用?C++ MasterScore::undoStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterScore
的用法示例。
在下文中一共展示了MasterScore::undoStack方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFile
void TestImplodeExplode::implode1()
{
QString readFile(DIR + "implode1.mscx");
QString writeFile1("implode1-test1.mscx");
QString writeFile2("implode1-test2.mscx");
QString reference(DIR + "implode1-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// select all
score->startCmd();
score->cmdSelectAll();
score->endCmd();
// do
score->startCmd();
score->cmdImplode();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, readFile));
delete score;
}
示例2: readScore
void TestSpanners::spanners13()
{
DropData dropData;
LayoutBreak* brk;
MasterScore* score = readScore(DIR + "lyricsline06.mscx");
QVERIFY(score);
score->doLayout();
// DROP A BREAK AT FIRST MEASURE AND VERIFY
Measure* msr = score->firstMeasure();
QVERIFY(msr);
brk = new LayoutBreak(score);
brk->setLayoutBreakType(LayoutBreak::Type::LINE);
dropData.pos = msr->pagePos();
dropData.element = brk;
score->startCmd();
msr->drop(dropData);
score->endCmd();
// VERIFY SEGMENTS IN SYSTEMS AND THEN SCORE
for (System* sys : score->systems())
QVERIFY(sys->spannerSegments().size() == 1);
QVERIFY(saveCompareScore(score, "lyricsline06.mscx", DIR + "lyricsline06-ref.mscx"));
// UNDO AND VERIFY
score->undoStack()->undo();
score->doLayout(); // systems need to be re-computed
QVERIFY(saveCompareScore(score, "lyricsline06.mscx", DIR + "lyricsline06.mscx"));
delete score;
}
示例3: undoLockLineBreaks
void TestTools::undoLockLineBreaks()
{
QString readFile(DIR + "undoLockLineBreaks.mscx");
QString writeFile1("undoLockLineBreaks01-test.mscx");
QString reference1(DIR + "undoLockLineBreaks01-ref.mscx");
QString writeFile2("undoLockLineBreaks02-test.mscx");
QString reference2(DIR + "undoLockLineBreaks02-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// select all
score->startCmd();
score->cmdSelectAll();
score->endCmd();
// do
score->startCmd();
score->addRemoveBreaks(0, true);
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例4: undoSlashFill
void TestTools::undoSlashFill()
{
QString readFile(DIR + "undoSlashFill.mscx");
QString writeFile1("undoSlashFill01-test.mscx");
QString reference1(DIR + "undoSlashFill01-ref.mscx");
QString writeFile2("undoSlashFill02-test.mscx");
QString reference2(DIR + "undoSlashFill02-ref.mscx");
MasterScore* score = readScore(readFile);
// select
Segment* s = score->firstMeasure()->findSegment(Segment::Type::ChordRest, MScore::division * 2);
score->selection().setRange(s, score->lastSegment(), 0, 2);
// do
score->startCmd();
score->cmdSlashFill();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例5: undoSlashRhythm
void TestTools::undoSlashRhythm()
{
QString readFile(DIR + "undoSlashRhythm.mscx");
QString writeFile1("undoSlashRhythm01-test.mscx");
QString reference1(DIR + "undoSlashRhythm01-ref.mscx");
QString writeFile2("undoSlashRhythm02-test.mscx");
QString reference2(DIR + "undoSlashRhythm02-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// select all
score->startCmd();
score->cmdSelectAll();
score->endCmd();
// do
score->startCmd();
score->cmdSlashRhythm();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo(&ed);
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例6: undoResequencePart
void TestTools::undoResequencePart()
{
QString readFile(DIR + "undoResequencePart.mscx");
QString writeFile1("undoResequencePart01-test.mscx");
QString reference1(DIR + "undoResequencePart01-ref.mscx");
QString writeFile2("undoResequencePart02-test.mscx");
QString reference2(DIR + "undoResequencePart02-ref.mscx");
MasterScore* score = readScore(readFile);
score->doLayout();
// do
score->startCmd();
score->cmdResequenceRehearsalMarks();
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undoStack()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例7: ex
void TestLinks::test5LinkedParts_94911()
{
MCursor c;
c.setTimeSig(Fraction(4,4));
c.createScore("test");
c.addPart("electric-guitar");
c.move(0, 0); // move to track 0 tick 0
c.addKeySig(Key(1));
c.addTimeSig(Fraction(4,4));
c.addChord(60, TDuration(TDuration::DurationType::V_WHOLE));
MasterScore* score = c.score();
score->addText("title", "Title");
score->doLayout();
// delete chord
Measure* m = score->firstMeasure();
Segment* s = m->first(Segment::Type::ChordRest);
Element* e = s->element(0);
QVERIFY(e->type() == ElementType::CHORD);
score->select(e);
score->cmdDeleteSelection();
e = s->element(0);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links() == nullptr);
// create parts//
score->startCmd();
QList<Part*> parts;
parts.append(score->parts().at(0));
Score* nscore = new Score(score);
Excerpt ex(score);
ex.setPartScore(nscore);
ex.setTitle("Guitar");
ex.setParts(parts);
Excerpt::createExcerpt(&ex);
QVERIFY(nscore);
score->undo(new AddExcerpt(&ex));
score->endCmd();
// we should have now 1 staff and 2 linked rests
QVERIFY(score->staves().size() == 1);
e = s->element(0);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links()->size() == 2);
// add a linked staff
score->startCmd();
Staff* oStaff = score->staff(0);
Staff* staff = new Staff(score);
staff->setPart(oStaff->part());
score->undoInsertStaff(staff, 1);
Excerpt::cloneStaff(oStaff, staff);
score->endCmd();
// we should have now 2 staves and 3 linked rests
QCOMPARE(score->staves().size(), 2);
QCOMPARE(nscore->staves().size(), 1);
QVERIFY(score->staves()[0]->linkedStaves()->staves().size() == 3);
e = s->element(0);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links()->size() == 3);
e = s->element(4);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links()->size() == 3);
QVERIFY(score->excerpts().size() == 1);
// undo
score->undoStack()->undo();
// we should have now 1 staves and 2 linked rests
QVERIFY(score->staves().size() == 1);
QVERIFY(score->staves()[0]->linkedStaves()->staves().size() == 2);
e = s->element(0);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links()->size() == 2);
QVERIFY(score->excerpts().size() == 1);
// redo
score->undoStack()->redo();
// we should have now 2 staves and 3 linked rests
QVERIFY(score->staves().size() == 2);
QVERIFY(score->staves()[0]->linkedStaves()->staves().size() == 3);
e = s->element(0);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links()->size() == 3);
e = s->element(4);
QVERIFY(e->type() == ElementType::REST);
QVERIFY(e->links()->size() == 3);
QVERIFY(score->excerpts().size() == 1);
}