本文整理汇总了C++中MidiTrack::setSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiTrack::setSelected方法的具体用法?C++ MidiTrack::setSelected怎么用?C++ MidiTrack::setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiTrack
的用法示例。
在下文中一共展示了MidiTrack::setSelected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePartSelection
void TrackListView::updatePartSelection(Part* part)/*{{{*/
{
if(part)
{
MidiTrack* track = part->track();
Part* curPart = m_editor->curCanvasPart();
if (curPart)
{
song->setRecordFlag(curPart->track(), false);
}
m_editor->setCurCanvasPart(part);
Song::movePlaybackToPart(part);
// and turn it on for the new parts track
song->setRecordFlag(track, true);
song->deselectTracks();
song->deselectAllParts();
track->setSelected(true);
part->setSelected(true);
song->update(SC_SELECTION);
int psn = part->sn();
for(int i = 0; i < m_model->rowCount(); ++i)
{
QStandardItem* item = m_model->item(i, 0);
if(item)
{
int type = item->data(TrackRole).toInt();
if(type == 1)
{//TrackMode
continue;
}
else
{//PartMode
int sn = item->data(PartRole).toInt();
if(psn == sn)
{
m_selectedIndex = item->row();
m_tempColor = item->foreground();
m_model->blockSignals(true);
item->setForeground(QColor(99, 36, 36));
m_model->blockSignals(false);
update();
m_table->selectRow(m_selectedIndex);
m_table->scrollTo(m_model->index(m_selectedIndex, 0));
m_colorRows.append(m_selectedIndex);
QTimer::singleShot(350, this, SLOT(updateColor()));
break;
}
}
}
}
}
}/*}}}*/
示例2: importMidi
//.........这里部分代码省略.........
track->setDefaultPartColor(lastTrackPartColorIndex);
lastTrackPartColorIndex ++;
if(lastTrackPartColorIndex == NUM_PARTCOLORS)
lastTrackPartColorIndex = 1;
//Set track channel so buildMidiEventList can match the event to a channel
track->setOutChannel(chan);
track->setOutPort(mPort);
MidiPort* mport = &midiPorts[track->outPort()];
// this overwrites any instrument set for this port:
mport->setInstrument(instr);
EventList* mel = track->events();
buildMidiEventList(mel, el, track, division, first, false, false);
first = false;
processTrack(track);
//Update track to channel 1
//99% of all midi we import will be alien to our setup anyway,
//so I'm making it easy for the user to just set the Instrument and go
track->setOutChannel(0);
song->insertTrack(track, -1);
mPort++;
//FIXME: Provice a non-iterative way to do this using the new losMidiPorts hash
//Or maintain a list of configured or inuse ports
while((&midiPorts[mPort])->device() && mPort < kMaxMidiPorts)
mPort++;//Just incase we have a configured port after an empty one
}
}
}
if (first)
{
//
// track does only contain non-channel messages
// (SYSEX or META)
//
MidiTrack* track = new MidiTrack();
track->setDefaultName();
track->setMasterFlag(true);
track->setOutChannel(0);
track->setOutPort(mPort);
if(config.partColorNames[lastTrackPartColorIndex].contains("menu:", Qt::CaseSensitive))
lastTrackPartColorIndex ++;
track->setDefaultPartColor(lastTrackPartColorIndex);
lastTrackPartColorIndex ++;
if(lastTrackPartColorIndex == NUM_PARTCOLORS)
lastTrackPartColorIndex = 1;
EventList* mel = track->events();
// Do SysexMeta. Don't do loops.
// TODO: Properly support sysex dumps
buildMidiEventList(mel, el, track, division, true, false, false);
processTrack(track);
song->insertTrack(track, -1);
mPort++;
while((&midiPorts[mPort])->device() && mPort < kMaxMidiPorts)
mPort++;
}
}
if (!merge)
{
MidiTrackList* tl = song->tracks();
if (!tl->empty())
{
MidiTrack* track = tl->front();
track->setSelected(true);
}
song->initLen();
int z, n;
sigmap.timesig(0, z, n);
int tempo = tempomap.tempo(0);
transport->setTimesig(z, n);
transport->setTempo(tempo);
bool masterF = !tempomap.empty();
song->setMasterFlag(masterF);
transport->setMasterFlag(masterF);
song->updatePos();
composer->reset();
}
else
{
song->initLen();
}
return false;
}/*}}}*/