本文整理汇总了C++中QLCPhysical::loadXML方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCPhysical::loadXML方法的具体用法?C++ QLCPhysical::loadXML怎么用?C++ QLCPhysical::loadXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCPhysical
的用法示例。
在下文中一共展示了QLCPhysical::loadXML方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}