本文整理汇总了C++中QLCFixtureHead::loadXML方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCFixtureHead::loadXML方法的具体用法?C++ QLCFixtureHead::loadXML怎么用?C++ QLCFixtureHead::loadXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCFixtureHead
的用法示例。
在下文中一共展示了QLCFixtureHead::loadXML方法的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: loadXML
bool QLCFixtureMode::loadXML(const QDomElement& root)
{
if (root.tagName() != KXMLQLCFixtureMode)
{
qWarning() << Q_FUNC_INFO << "Mode tag not found";
return false;
}
/* Mode name */
QString str = root.attribute(KXMLQLCFixtureModeName);
if (str.isEmpty() == true)
{
qWarning() << Q_FUNC_INFO << "Mode has no name";
return false;
}
else
{
setName(str);
}
/* Subtags */
QDomNode node = root.firstChild();
while (node.isNull() == false)
{
QDomElement tag = node.toElement();
if (tag.tagName() == KXMLQLCFixtureModeChannel)
{
/* Channel */
Q_ASSERT(m_fixtureDef != NULL);
str = tag.attribute(KXMLQLCFixtureModeChannelNumber);
insertChannel(m_fixtureDef->channel(tag.text()),
str.toInt());
}
else if (tag.tagName() == KXMLQLCFixtureHead)
{
/* Head */
QLCFixtureHead head;
if (head.loadXML(tag) == true)
insertHead(-1, head);
}
else if (tag.tagName() == KXMLQLCPhysical)
{
/* Physical */
QLCPhysical physical;
physical.loadXML(tag);
setPhysical(physical);
}
else
{
qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << tag.tagName();
}
node = node.nextSibling();
}
// Cache all head channels
cacheHeads();
return true;
}
示例3: loadXML
bool QLCFixtureMode::loadXML(QXmlStreamReader &doc)
{
if (doc.name() != KXMLQLCFixtureMode)
{
qWarning() << Q_FUNC_INFO << "Mode tag not found";
return false;
}
/* Mode name */
QString str = doc.attributes().value(KXMLQLCFixtureModeName).toString();
if (str.isEmpty() == true)
{
qWarning() << Q_FUNC_INFO << "Mode has no name";
return false;
}
else
{
setName(str);
}
/* Subtags */
while (doc.readNextStartElement())
{
if (doc.name() == KXMLQLCFixtureModeChannel)
{
/* Channel */
Q_ASSERT(m_fixtureDef != NULL);
str = doc.attributes().value(KXMLQLCFixtureModeChannelNumber).toString();
insertChannel(m_fixtureDef->channel(doc.readElementText()),
str.toInt());
}
else if (doc.name() == KXMLQLCFixtureHead)
{
/* Head */
QLCFixtureHead head;
if (head.loadXML(doc) == true)
insertHead(-1, head);
}
else if (doc.name() == KXMLQLCPhysical)
{
/* Physical */
QLCPhysical physical;
physical.loadXML(doc);
setPhysical(physical);
}
else
{
qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << doc.name();
doc.skipCurrentElement();
}
}
// Cache all head channels
cacheHeads();
return true;
}