示例#1
0
Score* QmlPlugin::newScore(const QString& name, const QString& part, int measures)
      {
      if (msc->currentScore()) {
            msc->currentScore()->endCmd();
            msc->endCmd();
            }
      Score* score = new Score(MScore::defaultStyle());
      score->setName(name);
      score->appendPart(part);
      score->appendMeasures(measures);
      score->doLayout();
      int view = msc->appendScore(score);
      msc->setCurrentView(0, view);
      qApp->processEvents();
      score->startCmd();
      return score;
      }
示例#2
0
Score* QmlPlugin::newScore(const QString& name, const QString& part, int measures)
{
    if (msc->currentScore())
        msc->currentScore()->endCmd();
    Score* score = new Score(MScore::defaultStyle());
    score->setName(name);
    score->appendPart(part);
    score->appendMeasures(measures);
    score->doLayout();
    int view = msc->appendScore(score);
    msc->setCurrentView(0, view);
    qApp->processEvents();
    // tell QML not to garbage collect this score
    QQmlEngine::setObjectOwnership(score, QQmlEngine::CppOwnership);
    score->startCmd();
    return score;
}
示例#3
0
void Lilypond::convert()
      {
      ci   = 0;
      line = 0;
      tick = 0;

      part = new Part(score);
      score->appendPart(part);

      staff = new Staff(score, part, 0);
      score->staves().push_back(staff);
      part->staves()->push_back(staff);

      measure = new Measure(score);
      measure->setTick(tick);
      score->add(measure);

      QChar c = lookup();
      if (c == '\\') {
            ++ci;
            scanCmd();
            }
      if (!lookup('{'))
            error("{ expected");
      ++ci;
      for (QChar c = lookup(); !c.isNull() && c != '}'; c = lookup()) {
            switch(c.toAscii()) {
                  case 'a' ... 'g':
                        {
                        LNote note = scanNote();
                        addNote(note);
                        }
                        break;
                  case 'r':
                        scanRest();
                        addRest();
                        break;
                  default:
                        printf("unexpected char <%c>\n", c.toAscii());
                        ++ci;
                        break;
                  }
            }
      }