本文整理汇总了C++中QLCFixtureHead::channels方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCFixtureHead::channels方法的具体用法?C++ QLCFixtureHead::channels怎么用?C++ QLCFixtureHead::channels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCFixtureHead
的用法示例。
在下文中一共展示了QLCFixtureHead::channels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void QLCFixtureHead_Test::load()
{
QBuffer buffer;
buffer.open(QIODevice::WriteOnly | QIODevice::Text);
QXmlStreamWriter xmlWriter(&buffer);
xmlWriter.writeStartElement("Head");
xmlWriter.writeTextElement("Channel", "0");
xmlWriter.writeTextElement("Channel", "1");
xmlWriter.writeTextElement("Channel", "15");
xmlWriter.writeTextElement("Foo", "25");
xmlWriter.writeTextElement("Channel", "42");
xmlWriter.writeEndDocument();
xmlWriter.setDevice(NULL);
buffer.close();
buffer.open(QIODevice::ReadOnly | QIODevice::Text);
QXmlStreamReader xmlReader(&buffer);
xmlReader.readNextStartElement();
QLCFixtureHead head;
QVERIFY(head.loadXML(xmlReader));
QCOMPARE(head.channels().size(), 4);
QVERIFY(head.channels().contains(0));
QVERIFY(head.channels().contains(1));
QVERIFY(head.channels().contains(15));
QVERIFY(head.channels().contains(42));
}
示例2: refreshHeadList
void EditMode::refreshHeadList()
{
m_headList->clear();
for (int i = 0; i < m_mode->heads().size(); i++)
{
QTreeWidgetItem* item = new QTreeWidgetItem(m_headList);
QLCFixtureHead head = m_mode->heads().at(i);
QList <quint32> channels(head.channels());
qSort(channels.begin(), channels.end());
QString summary;
QListIterator <quint32> it(channels);
while (it.hasNext() == true)
{
quint32 chnum = it.next();
const QLCChannel* ch = m_mode->channel(chnum);
QTreeWidgetItem* chitem = new QTreeWidgetItem(item);
if (ch != NULL)
chitem->setText(0, QString("%1: %2").arg(chnum + 1).arg(ch->name()));
else
chitem->setText(0, QString("%1: INVALID!"));
chitem->setFlags(0); // Disable channel selection inside heads
summary += QString::number(chnum + 1);
if (it.hasNext() == true)
summary += QString(", ");
}
item->setText(0, QString("Head %1 (%2)").arg(i + 1).arg(summary));
}
m_headList->resizeColumnToContents(0);
}
示例3: channels
void QLCFixtureHead_Test::channels()
{
QLCFixtureHead head;
QCOMPARE(head.channels().size(), 0);
head.addChannel(0);
QCOMPARE(head.channels().size(), 1);
QCOMPARE(head.channels().contains(0), true);
head.addChannel(0);
QCOMPARE(head.channels().size(), 1);
QCOMPARE(head.channels().contains(0), true);
head.addChannel(5000);
QCOMPARE(head.channels().size(), 2);
QCOMPARE(head.channels().contains(0), true);
QCOMPARE(head.channels().contains(5000), true);
head.removeChannel(1);
QCOMPARE(head.channels().size(), 2);
QCOMPARE(head.channels().contains(0), true);
QCOMPARE(head.channels().contains(5000), true);
head.removeChannel(0);
QCOMPARE(head.channels().size(), 1);
QCOMPARE(head.channels().contains(5000), true);
head.removeChannel(5000);
QCOMPARE(head.channels().size(), 0);
}