本文整理汇总了C++中QDomNode::hasChildNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::hasChildNodes方法的具体用法?C++ QDomNode::hasChildNodes怎么用?C++ QDomNode::hasChildNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNode
的用法示例。
在下文中一共展示了QDomNode::hasChildNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNextNode
QDomNode DataBase::getNextNode(QDomNode ¤tNode, QDomNode &lastNode) {
DBGS(PRINT_START("currentNode: 0x%08x, lastNode: 0x%08x", ¤tNode, &lastNode));
QDomNode nextNode;
if (currentNode.hasChildNodes()) {
nextNode = currentNode.firstChild();
}
else {
QDomNode previousNode = currentNode;
nextNode = currentNode.nextSibling();
while (nextNode.isNull()) {
QDomNode parentNode = previousNode.parentNode();
if (parentNode == lastNode) {
break;
}
else {
previousNode = parentNode;
nextNode = parentNode.nextSibling();
}
}
}
DBGR(PRINT_RETURN("nextNode: 0x%08x", &nextNode));
return nextNode;
}
示例2: removeDefaultNode
void QQMlDom::removeDefaultNode(QDomElement nDocument, QString element)
{
QDomNodeList removeList = nDocument.elementsByTagName(element);
QDomNode rUrl = removeList.at(0);
qDebug() << "is there a child node ?" << rUrl.hasChildNodes() <<" " << rUrl.childNodes().at(0).nodeName() ;
rUrl.removeChild(rUrl.childNodes().at(0));
}
示例3: extractTextFromParagraph
QString ExampleContent::extractTextFromParagraph(const QDomNode &parentNode)
{
QString description;
QDomNode node = parentNode.firstChild();
while (!node.isNull()) {
QString beginTag;
QString endTag;
if (node.isText())
description += Colors::contentColor + node.nodeValue();
else if (node.hasChildNodes()) {
if (node.nodeName() == "b") {
beginTag = "<b>";
endTag = "</b>";
} else if (node.nodeName() == "a") {
beginTag = Colors::contentColor;
endTag = "</font>";
} else if (node.nodeName() == "i") {
beginTag = "<i>";
endTag = "</i>";
} else if (node.nodeName() == "tt") {
beginTag = "<tt>";
endTag = "</tt>";
}
description += beginTag + this->extractTextFromParagraph(node) + endTag;
}
node = node.nextSibling();
}
return description;
}
示例4: processNode
void ItemDefinitionGroup::processNode(const QDomNode &node)
{
if (node.isElement())
processNodeAttributes(node.toElement());
if (node.hasChildNodes())
processChildNodes(node.firstChild());
}
示例5: hasChildNodes
bool QDomNodeProto:: hasChildNodes() const
{
QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
if (item)
return item->hasChildNodes();
return false;
}
示例6: loadSectionItem
bool Configurator::loadSectionItem( QDomNode sectionItem, QListWidget& listWidget )
{
if( false == sectionItem.hasChildNodes() )
return false;
if( sectionItem.nodeName() != c_sectionItemNodeName )
return false;
QDomNamedNodeMap sectionItemAttributes = sectionItem.attributes();
if( false == sectionItemAttributes.contains(c_attributeName) )
return false;
if( false == sectionItemAttributes.contains(c_attributeText) )
return false;
// add the item to the section
QString sectionItemName = sectionItemAttributes.namedItem(c_attributeName).nodeValue();
QString sectionItemText = sectionItemAttributes.namedItem(c_attributeText).nodeValue();
QListWidgetItem* listWidgetItem = new QListWidgetItem();
listWidgetItem->setText( sectionItemText );
listWidgetItem->setData( Qt::UserRole, sectionItemName );
listWidget.addItem( listWidgetItem );
return true;
}
示例7: setAsXMLNode
bool ReturnInstruction::setAsXMLNode(QDomNode& node)
{
if (node.hasChildNodes()) {
QDomNodeList nodeList = node.childNodes();
for (unsigned i = 0; i < nodeList.length(); i++) {
QDomElement e = nodeList.item(i).toElement();
if (!e.isNull()) {
if (e.tagName() == "text") {
QDomNode t = e.firstChild();
setContents(t.nodeValue());
} else if (e.tagName() == "comment") {
QDomNode t = e.firstChild();
setComment(t.nodeValue());
}
}
}
} else {
// tekst, komentarz i pixmapa puste
}
validateContents();
return true;
}
示例8: _getTitle
/**
Get the project title
XML in file has this form:
\verbatim
<qgis projectname="default project">
<title>a project title</title>
\endverbatim
@todo XXX we should go with the attribute xor title, not both.
*/
static void _getTitle( QDomDocument const &doc, QString & title )
{
QDomNodeList nl = doc.elementsByTagName( "title" );
title = ""; // by default the title will be empty
if ( !nl.count() )
{
QgsDebugMsg( "unable to find title element" );
return;
}
QDomNode titleNode = nl.item( 0 ); // there should only be one, so zeroth element ok
if ( !titleNode.hasChildNodes() ) // if not, then there's no actual text
{
QgsDebugMsg( "unable to find title element" );
return;
}
QDomNode titleTextNode = titleNode.firstChild(); // should only have one child
if ( !titleTextNode.isText() )
{
QgsDebugMsg( "unable to find title element" );
return;
}
QDomText titleText = titleTextNode.toText();
title = titleText.data();
} // _getTitle
示例9:
/* $Desc Add text inside the node s markups. If any already exists, it s
* over written.
* $Parm p_node Node on which to write.
* $Parm p_value Text to fill in.
* $Rtrn /.
*/
void
XmlBehavior::addText(QDomNode& p_node, const QString& p_value) const
{
if(p_node.hasChildNodes())
logE("Try to add text to a node with children");
p_node.appendChild(p_node.ownerDocument().createTextNode(p_value));
}
示例10: processNode
void Project::processNode(const QDomNode &node)
{
if (node.isElement())
processNodeAttributes(node.toElement());
if (node.hasChildNodes())
processChildNodes(node.firstChild());
}
示例11: result
quint16 BaseDataHandler::getUint16(const QDomNode& node) const
{
quint16 result(0);
if (node.hasChildNodes()){
QString text = node.firstChild().nodeValue();
QTextStream stream(&text);
stream >> result;
}
示例12: clearNodeContents
void XMLWriter::clearNodeContents(QDomNode& p_node)
{
while( p_node.hasChildNodes() )
{
QDomNode node = p_node.childNodes().at(0);
p_node.removeChild(node);
node.clear();
}
}
示例13: toString
QString QDomNodeProto::toString() const
{
QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
if (item)
return QString("[QDomNode(%1=%2, %3, %4)]")
.arg(item->nodeName())
.arg(item->nodeValue())
.arg(item->nodeType())
.arg(item->hasChildNodes() ? "has children" : "leaf node");
return QString("[QDomNode(unknown)]");
}
示例14:
void pokedex::parse_moves(const QDomNode &noeud, pokemon &poke)
{
if (noeud.hasChildNodes())
{
QDomNode noeud2 = noeud.firstChild();
while (!noeud2.isNull())
{
this->parse_move(noeud2, poke);
noeud2 = noeud2.nextSibling();
}
}
}
示例15: if
void pokedex::parse_ratio(const QDomNode &noeud, pokemon &poke)
{
if (noeud.hasChildNodes())
{
QDomNode noeud2 = noeud.firstChild();
while (!noeud2.isNull())
{
if (noeud2.nodeName() == "male")
poke.setRatioMale(noeud2.toElement().text().toFloat());
else if (noeud2.nodeName() == "female")
poke.setRatioFemale(noeud2.toElement().text().toFloat());
noeud2 = noeud2.nextSibling();
}
}
}