本文整理汇总了C++中MidiTrack::getDefaultPartColor方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiTrack::getDefaultPartColor方法的具体用法?C++ MidiTrack::getDefaultPartColor怎么用?C++ MidiTrack::getDefaultPartColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiTrack
的用法示例。
在下文中一共展示了MidiTrack::getDefaultPartColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextPopupMenu
void TrackListView::contextPopupMenu(QPoint pos)/*{{{*/
{
QModelIndex mindex = m_table->indexAt(pos);
if(!mindex.isValid())
return;
//int row = mindex.row();
QStandardItem* item = m_model->itemFromIndex(mindex);
if(item)
{
m_selectedIndex = item->row();
//Make it works even if you rightclick on the checkbox
QString trackName = item->data(TrackNameRole).toString();
int type = item->data(TrackRole).toInt();
MidiTrack* track = song->findTrack(trackName);
if(!track || !m_editor)
return;
QMenu* p = new QMenu(this);
QString title(tr("Part Color"));
int index = track->getDefaultPartColor();
Part* npart = 0;
if(type == 1)
title = QString(tr("Default Part Color"));
else
{
PartList* list = track->parts();
int sn = item->data(PartRole).toInt();
unsigned tick = item->data(TickRole).toInt();
npart = list->find(tick, sn);
if(npart)
index = npart->colorIndex();
}
QMenu* colorPopup = p->addMenu(title);
QMenu* colorSub;
for (int i = 0; i < NUM_PARTCOLORS; ++i)
{
QString colorname(config.partColorNames[i]);
if(colorname.contains("menu:", Qt::CaseSensitive))
{
colorSub = colorPopup->addMenu(colorname.replace("menu:", ""));
}
else
{
if(index == i)
{
colorname = QString(config.partColorNames[i]);
colorPopup->setIcon(partColorIconsSelected.at(i));
colorPopup->setTitle(colorSub->title()+": "+colorname);
colorname = QString("* "+config.partColorNames[i]);
QAction *act_color = colorSub->addAction(partColorIconsSelected.at(i), colorname);
act_color->setData(20 + i);
}
else
{
colorname = QString(" "+config.partColorNames[i]);
QAction *act_color = colorSub->addAction(partColorIcons.at(i), colorname);
act_color->setData(20 + i);
}
}
}
p->addAction(tr("Add Part"))->setData(1);
p->addAction(tr("Add Part and Select"))->setData(2);
if(type == 2)
p->addAction(tr("Delete Part"))->setData(3);
QAction* act = p->exec(QCursor::pos());
if (act)
{
int selection = act->data().toInt();
switch(selection)
{
case 1:
{
CItem *citem = los->composer->addCanvasPart(track);
if(citem)
{
Part* mp = citem->part();
populateTable();//update check state
//Select and scroll to the added part
if(mp)
{
int psn = mp->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_tempColor = item->foreground();
m_model->blockSignals(true);
//.........这里部分代码省略.........