本文整理汇总了C++中MidiDevice::beginControllers方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::beginControllers方法的具体用法?C++ MidiDevice::beginControllers怎么用?C++ MidiDevice::beginControllers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::beginControllers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: colourPixmap
void
ControlEditorDialog::slotUpdate(bool added)
{
RG_DEBUG << "ControlEditorDialog::slotUpdate" << endl;
MidiDevice *md =
dynamic_cast<MidiDevice *>(m_studio->getDevice(m_device));
if (!md)
return ;
ControlList::const_iterator it = md->beginControllers();
ControlParameterItem *item;
int i = 0;
// Attempt to track last controller selected so we can reselect it
int lastControllerId = -1;
ControlParameterItem *lastItem = dynamic_cast<ControlParameterItem *>(m_treeWidget->currentItem());
if (lastItem) {
lastControllerId = lastItem->getId();
}
m_treeWidget->clear();
for (; it != md->endControllers(); ++it) {
Composition &comp = m_doc->getComposition();
QString colour =
strtoqstr(comp.getGeneralColourMap().getNameByIndex(it->getColourIndex()));
if (colour == "")
colour = tr("<default>");
QString position = QString("%1").arg(it->getIPBPosition());
if (position.toInt() == -1)
position = tr("<not showing>");
QString value;
value.sprintf("%d (0x%x)", it->getControllerValue(),
it->getControllerValue());
if (it->getType() == PitchBend::EventType) {
item = new ControlParameterItem(
i++,
m_treeWidget,
QStringList()
<< strtoqstr(it->getName())
<< strtoqstr(it->getType())
<< QString("-")
<< strtoqstr(it->getDescription())
<< QString("%1").arg(it->getMin())
<< QString("%1").arg(it->getMax())
<< QString("%1").arg(it->getDefault())
<< colour
<< position
);
} else {
item = new ControlParameterItem(
i++,
m_treeWidget,
QStringList()
<< strtoqstr(it->getName())
<< strtoqstr(it->getType())
<< value
<< strtoqstr(it->getDescription())
<< QString("%1").arg(it->getMin())
<< QString("%1").arg(it->getMax())
<< QString("%1").arg(it->getDefault())
<< colour
<< position
);
}
if (item->getId() == lastControllerId) {
m_treeWidget->setCurrentItem(item);
}
// create and set a colour pixmap
//
QPixmap colourPixmap(16, 16);
Colour c = comp.getGeneralColourMap().getColourByIndex(it->getColourIndex());
colourPixmap.fill(QColor(c.getRed(), c.getGreen(), c.getBlue()));
item->setIcon(7, QIcon(colourPixmap));
m_treeWidget->addTopLevelItem(item);
}
if(m_treeWidget->topLevelItemCount() == 0) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_treeWidget, QStringList(tr("<none>")));
m_treeWidget->addTopLevelItem(item);
m_treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
} else {
m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
}
// This logic is kind of frigged up, and may be too fragile. It assumes
// that if you added an item, the last thing iterated through will be that
// new item, so the value of the variable item will be the last thing
//.........这里部分代码省略.........