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; }
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; }