示例#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;
}