[rev 5478] can't set key signature for the first measure

• Mar 30, 2012 - 10:27

still ove importer. rev 5478.

There are some changes in KeySig set. I used to use
(*score_->staff(staffCount + j)->keymap())[tick] = key;
and this line was commented for a long time, then I use something from importxml.cpp

KeySigEvent oldkey = score_->staff(staffCount + j)->keymap()->key(tick);
if (oldkey != key) {
Measure *measure = static_cast(score_->measure(k));
if(measure) {
KeySig* keysig = new KeySig(score_);
keysig->setTrack((staffCount+j) * VOICES);
keysig->setKeySigEvent(key);
keysig->setVisible(true);

Segment* s = measure->getSegment(keysig, tick);
s->add(keysig);
}
}

But it does not work for the first measure, which is tick==0, I noticed it did create the Segment of type SegKeySig and add el to that segment.


Comments

I notice I get 2 Measure which _tick=0.
This is because I add a VBox which contains title and author text to Score::measures(), so when I calll Score::measure(int idx), I get vbox for idx=0, it's not a Measure.
So this is the problem, I already fix to get the right Measure.

Do you still have an unanswered question? Please log in first to post your question.