当前位置: 首页>>代码示例>>C++>>正文


C++ QDomNode::hasChildNodes方法代码示例

本文整理汇总了C++中QDomNode::hasChildNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::hasChildNodes方法的具体用法?C++ QDomNode::hasChildNodes怎么用?C++ QDomNode::hasChildNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDomNode的用法示例。


在下文中一共展示了QDomNode::hasChildNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getNextNode

QDomNode DataBase::getNextNode(QDomNode &currentNode, QDomNode &lastNode) {
  DBGS(PRINT_START("currentNode: 0x%08x, lastNode: 0x%08x", &currentNode, &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;
}
开发者ID:ixotum,项目名称:ksilit_qt,代码行数:28,代码来源:database.cpp

示例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));
}
开发者ID:JosephMillsAtWork,项目名称:InstallerFrontend,代码行数:7,代码来源:qqmldom.cpp

示例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;
}
开发者ID:cedrus,项目名称:qt4,代码行数:31,代码来源:examplecontent.cpp

示例4: processNode

void ItemDefinitionGroup::processNode(const QDomNode &node)
{
    if (node.isElement())
        processNodeAttributes(node.toElement());
    if (node.hasChildNodes())
        processChildNodes(node.firstChild());
}
开发者ID:pivonroll,项目名称:VCProjectX,代码行数:7,代码来源:itemdefinitiongroup.cpp

示例5: hasChildNodes

bool QDomNodeProto:: hasChildNodes() const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->hasChildNodes();
  return false;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例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;
}
开发者ID:ktos,项目名称:nsbuilder,代码行数:26,代码来源:returninstruction.cpp

示例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
开发者ID:Arctictern265,项目名称:Quantum-GIS,代码行数:44,代码来源:qgsproject.cpp

示例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));
}
开发者ID:agrum,项目名称:ksir,代码行数:14,代码来源:xmlbehavior.cpp

示例10: processNode

void Project::processNode(const QDomNode &node)
{
    if (node.isElement())
        processNodeAttributes(node.toElement());

    if (node.hasChildNodes())
        processChildNodes(node.firstChild());
}
开发者ID:pivonroll,项目名称:VCProjectX,代码行数:8,代码来源:project.cpp

示例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;
    }
开发者ID:carlitux,项目名称:twittrex,代码行数:8,代码来源:basedatahandler.cpp

示例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();
    }
}
开发者ID:capeisti,项目名称:uistelupaivakirja-desktop,代码行数:9,代码来源:xmlwriter.cpp

示例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)]");
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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();
		}
	}
}
开发者ID:tbronchain,项目名称:school,代码行数:12,代码来源:pokedexParse.cpp

示例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();
		}
	}
}
开发者ID:tbronchain,项目名称:school,代码行数:15,代码来源:pokedexParse.cpp


注:本文中的QDomNode::hasChildNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。