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


C++ QDomText类代码示例

本文整理汇总了C++中QDomText的典型用法代码示例。如果您正苦于以下问题:C++ QDomText类的具体用法?C++ QDomText怎么用?C++ QDomText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: parseInstrName

static QString parseInstrName(const QString& name)
      {
      QString sName;
      QDomDocument dom;
      int line, column;
      QString err;
      if (!dom.setContent(name, false, &err, &line, &column)) {
            QString col, ln;
            col.setNum(column);
            ln.setNum(line);
            QString error = err + "\n at line " + ln + " column " + col;
            qDebug("error: %s\n", qPrintable(error));
            qDebug("   data:<%s>\n", qPrintable(name));
            return QString();
            }

      for (QDomNode e = dom.documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
            for (QDomNode ee = e.firstChild(); !ee.isNull(); ee = ee.nextSibling()) {
                  QDomElement el = ee.toElement();
                  const QString& tag(el.tagName());
                  if (tag == "symbol") {
                        QString name = el.attribute(QString("name"));
                        if (name == "flat")
                              sName += "b";
                        else if (name == "sharp")
                              sName += "#";
                        }
                  QDomText t = ee.toText();
                  if (!t.isNull())
                        sName += t.data();
                  }
            }
      return sName;
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:34,代码来源:instrtemplate.cpp

示例2: parseBlock

void Format::parseBlock( QTextCursor &cursor, const QDomElement &element )
{
//  dbg() << "Format::parseBlock()" << endl;

  QDomNode n;
  for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
    QDomElement e = n.toElement();
    if ( e.tagName() == "fragment" ) {
      QTextCharFormat format;
      if ( e.hasAttribute( "link" ) ) {
        format.setAnchor( true );
        QString href = e.attribute( "link" );
        format.setAnchorHref( href );
        format.setFontUnderline( true );
        if ( href.startsWith( "todoodle:" ) ) {
          format = TextFormats::topicLinkCharFormat( href );
        } else {
          format = TextFormats::hyperLinkCharFormat( href );
        }
      }
      if ( e.attribute( "bold" ) == "true" ) {
        format.setFontWeight( QFont::Bold );
      }
      if ( e.attribute( "italic" ) == "true" ) {
        format.setFontItalic( true );
      }
      int fontSize = 0;
      if ( e.hasAttribute( "fontsize" ) ) {
        fontSize = e.attribute( "fontsize" ).toInt();
      } else {
        fontSize = 10;
      }
      if ( fontSize > 0 ) format.setFontPointSize( fontSize );
      
      QDomNode n2;
      for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
//        dbg() << "TICK" << endl;
        QDomText t = n2.toText();
        if ( !t.isNull() ) {
//          dbg() << "TEXT: '" << t.data() << "'" << endl;
          cursor.insertText( t.data(), format );
//          dbg() << "done" << endl;
        } else {
          QDomElement e2 = n2.toElement();
          if ( !e2.isNull() ) {
            if ( e2.tagName() == "todo" ) {
              QTextImageFormat f;
              if ( e2.attribute( "status" ) == "todo" ) {
                f.setName( ":/images/todo.png" );
              } else {
                f.setName( ":/images/tododone.png" );
              }
              cursor.insertImage( f );
            }
          }
        }
      }
    }
  }
}
开发者ID:cornelius,项目名称:todoodle,代码行数:60,代码来源:format.cpp

示例3: while

  void
  operator <<= (ScanDescriptionIDL& description, const QDomNode& node)
  {
    description.group.length(0);

    if (!node.isNull()) {
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	if (n1.nodeName() == "sensorgroup") {
	  description.group.length(description.group.length() + 1);
	  description.group[description.group.length() - 1].sensor.length(0);
	  description.group[description.group.length() - 1] <<= n1;
	} 
	else if (n1.nodeName() == "scantype") {
	  QDomNode n2 = n1.firstChild();
	  if (!n2.isNull()) {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    description.scanType = t.data().toInt();
	  }
	}
	else if (n1.nodeName() == "eventname") {
	  QDomNode n2 = n1.firstChild();
	  if (!n2.isNull()) {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    description.eventName = CORBA::string_dup(t.data());
	  }
	}
	n1 = n1.nextSibling();
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:31,代码来源:ScanDescriptionHelper.cpp

示例4: while

/*
Esta funcion busca en el xmlDocumento hasta que encuentra el tag y retorna el valor del string contenido por el
@param tag: Es la etiqueta que contiene el texto buscado.
*/
QString SbXmlInterprete::xmlObtenerTexto(QString tag)
{
 	xmlElemento = xmlDocumento.documentElement(); // retorna la raiz del documento
	QDomNode nodo = xmlElemento.firstChild(); // se obtiene el primer Hijo

//	std::cout << "tagName: " << xmlElemento.tagName() << std::endl;
	
	while( ! nodo.isNull())
	{
		QDomElement elemento = nodo.toElement();
		QDomNode hijo = elemento.firstChild();

		while (! hijo.isNull())
		{
			QDomElement elemento2 = hijo.toElement();
			if ( !elemento2.isNull() )
			{
				QString tmpTagName = elemento2.tagName();
//				std::cout << tmpTagName;
				QDomText textChild = hijo.firstChild().toText();
				
				QString tmpTextData = textChild.nodeValue();
//				std::cout << ": " << tmpTextData << std::endl;
				if (elemento2.tagName() == tag)
				{
					return tmpTextData;
				}
			}
			hijo = hijo.nextSibling();
		}
		nodo = nodo.nextSibling();
	}
	return "";
}
开发者ID:BackupTheBerlios,项目名称:qapital-svn,代码行数:38,代码来源:sbxmlinterprete.cpp

示例5: doc

void UrlResolverTest::checkVerifyResponse(){
  QDomDocument doc("foo");

  QDomElement root = doc.createElement("foo");
  doc.appendChild(root);

  QDomElement action = doc.createElement("action");
  root.appendChild(action);
  action.appendChild(doc.createTextNode("register"));

  QDomElement deviceId = doc.createElement("deviceId");
  root.appendChild(deviceId);
  deviceId.appendChild(doc.createTextNode("deadbeef-dead-beef-dead"));

  QDomElement protocolVersion = doc.createElement("protocolVersion");
  root.appendChild(protocolVersion);

  QDomText protocolVersionText = doc.createTextNode(SSU_PROTOCOL_VERSION);
  protocolVersion.appendChild(protocolVersionText);

  QVERIFY(ssu.verifyResponse(&doc));

  protocolVersionText.setData(SSU_PROTOCOL_VERSION ".invalid");

  QVERIFY2(!ssu.verifyResponse(&doc),
      "Ssu::verifyResponse() should fail when protocolVersion does not match SSU_PROTOCOL_VERSION");
}
开发者ID:giucam,项目名称:ssu,代码行数:27,代码来源:urlresolvertest.cpp

示例6: _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:PhilippeDorelon,项目名称:Quantum-GIS,代码行数:44,代码来源:qgsproject.cpp

示例7:

void Ersky9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
{
    QDomElement e = qdoc->createElement(name);
    QDomText t = qdoc->createTextNode(name);
    t.setNodeValue(value);
    e.appendChild(t);
    pe->appendChild(e);
}
开发者ID:GrandK,项目名称:companion9x,代码行数:8,代码来源:ersky9xinterface.cpp

示例8: getText

QString KWDWriter::getText(const QDomElement &paragraph)
{
    QDomNode temp = paragraph.elementsByTagName("TEXT").item(0).firstChild();
    QDomText currentText = temp.toText();
    if (temp.isNull()) {
        kWarning(30503) << "no text";
    }
    return currentText.data();
}
开发者ID:KDE,项目名称:calligra-history,代码行数:9,代码来源:kwdwriter.cpp

示例9: getFirstText

static QString getFirstText(QDomElement element)
{
    for (QDomNode dname = element.firstChild(); !dname.isNull();
         dname = dname.nextSibling())
    {
        QDomText t = dname.toText();
        if (!t.isNull())
            return t.data();
    }
    return QString();
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:11,代码来源:xmltvparser.cpp

示例10: QStringLiteral

void QgsProjectBadLayerHandler::setDataSource( QDomNode &layerNode, const QString &dataSource )
{
  QDomNode dataSourceNode = layerNode.namedItem( QStringLiteral( "datasource" ) );
  QDomElement dataSourceElement = dataSourceNode.toElement();
  QDomText dataSourceText = dataSourceElement.firstChild().toText();

  QgsDebugMsg( "datasource changed from " + dataSourceText.data() );

  dataSourceText.setData( dataSource );

  QgsDebugMsg( "to " + dataSourceText.data() );
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:12,代码来源:qgsprojectbadlayerhandler.cpp

示例11: load

/**
 * Loads the <UML:CheckConstraint> XMI element.
 */
bool UMLCheckConstraint::load( QDomElement & element )
{
    QDomNode node = element.firstChild();

    QDomText checkConstraintText = node.toText();
    if ( checkConstraintText.isNull() )
        return false;

    m_CheckCondition = checkConstraintText.data();

    return true;
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:15,代码来源:checkconstraint.cpp

示例12: tagContent

QString tagContent(const QDomElement &e)
{
	// look for some tag content
	for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
		QDomText i = n.toText();
		if(i.isNull())
			continue;
		return i.data();
	}

	return "";
}
开发者ID:studzien,项目名称:iris,代码行数:12,代码来源:xmpp_xmlcommon.cpp

示例13:

/*!
 *\en
 *	Sets text for current node.
 *	\param text (in) - new text value.
 *	\return void.
 *\_en \ru
 *	Устанавливает текст текущего узла.
 *	\param text (in) - Значение нового текста.
 *	\return ничего.
 *\_ru
 */
bool
AExtXML::setText( const QString &text )
{
	QDomText t;
	if (current.isNull()) return false;
	while (!current.firstChild().isNull()) {
		current.removeChild( current.firstChild() );
	}
	t = xml.createTextNode( text );
	if ( t.isNull() ) return false;
	current.appendChild( t );
	return true;
}
开发者ID:K-Be,项目名称:ananas-labs-qt4,代码行数:24,代码来源:aextxml.cpp

示例14: FindNode

QString XmlConfiguration::GetValue( const QString &sSetting, QString sDefault ) 
{
    QDomNode node = FindNode( sSetting );

    if (!node.isNull())
    {
        // -=>TODO: This Always assumes firstChild is a Text Node... should change
        QDomText  oText = node.firstChild().toText();

        if (!oText.isNull())
            return oText.nodeValue();
    }

    return sDefault;
}
开发者ID:jhludwig,项目名称:mythtv,代码行数:15,代码来源:configuration.cpp

示例15: while

  void
  DifferentialMotionParameters::operator <<= (const QDomNode& _node)
  {
    Super::operator<<=(_node);

    QDomNode n = _node.firstChild();
    while( !n.isNull() ) {
      QDomElement e = n.toElement(); // try to convert the node to an element.
      if( !e.isNull() ) {            // the node was really an element.
	if (e.tagName()=="parameter") {
	  QDomAttr parameterName = e.attributeNode("name");
	  QString name;
	  QString value;

	  if (!parameterName.isNull()) {
	    name = parameterName.value();
	  }
	  else {
	    throw Exception("Parameter tag without name.");
	  }

	  QDomNode n2 = n.firstChild();
	  while (!n2.isNull()) {
	    QDomText t = n2.toText(); // try to convert the node to a text
	    if(!t.isNull() ) {        // the node was really a text element.
	      value = t.data();
	      break;
	    }
	    n2 = n2.nextSibling();
	  }
	  if (n2.isNull())
	    throw Exception("Parameter " + std::string(name) + "without value.");
	  
	  if (name == "MinLTranslation")
	    minLTranslation = value.toInt();
	  else if (name == "MaxLTranslation")
	    maxLTranslation = value.toInt();
	  else if (name == "MinRTranslation")
	    minRTranslation = value.toInt();
	  else if (name == "MaxRTranslation")
	    maxRTranslation = value.toInt();
	  else if (name == "WheelBase")
	    wheelBase = value.toInt();
	}
      }
      n = n.nextSibling();
    }
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:48,代码来源:MotionParameters.cpp


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