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


C++ QDomNodeList::length方法代码示例

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


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

示例1: main

int main(int argc, char* argv[])
{
    QString filename("config.xml");
    QFile f(filename);
    QDomDocument doc;

    doc.setContent(dynamic_cast<QIODevice*>(&f), false);

    QDomNodeList nodes = doc.elementsByTagName(QString("pythonpath"));
    for (unsigned int i = 0; i < nodes.length(); ++i) {
        QString s;
        s = nodes.at(i).toElement().text();
        s.replace(QString("$PYTHONHOME"), QString("/usr/bin/python27"));
        s.replace(QString("$PROJECT_PATH"), QString("~/mysample"));
        s.replace(QString("$PYTHON_VERSION"), QString("27"));

        printf("%s\n", s.toAscii().data());
    }
    return 0;
}
开发者ID:bradselb,项目名称:examples,代码行数:20,代码来源:bug.cpp

示例2: formatAttribute

QDomElement KWDWriter::formatAttribute(const QDomElement &paragraph,
                                       const QString& name,
                                       const QString& attrName,
                                       const QString& attr)
{
    QDomElement lastformat = currentFormat(paragraph, true);
    QDomNodeList qdnl = lastformat.elementsByTagName(name);
    if (qdnl.length()) {
        QDomElement el;
        el = qdnl.item(0).toElement();
        el.setAttribute(attrName, attr);
        return el;
    } else {
        QDomElement al = _doc->createElement(name);
        lastformat.appendChild(al);
        al.setAttribute(attrName, attr);
        return al;
    }

}
开发者ID:KDE,项目名称:calligra-history,代码行数:20,代码来源:kwdwriter.cpp

示例3: readXML

bool QgsAttributeAction::readXML( const QDomNode& layer_node )
{
  mActions.clear();

  QDomNode aaNode = layer_node.namedItem( "attributeactions" );

  if ( !aaNode.isNull() )
  {
    QDomNodeList actionsettings = aaNode.childNodes();
    for ( unsigned int i = 0; i < actionsettings.length(); ++i )
    {
      QDomElement setting = actionsettings.item( i ).toElement();
      addAction(( QgsAction::ActionType ) setting.attributeNode( "type" ).value().toInt(),
                setting.attributeNode( "name" ).value(),
                setting.attributeNode( "action" ).value(),
                setting.attributeNode( "capture" ).value().toInt() != 0 );
    }
  }
  return true;
}
开发者ID:aaronr,项目名称:Quantum-GIS,代码行数:20,代码来源:qgsattributeaction.cpp

示例4: loadIncludes

void ConfigLoader::loadIncludes(QDomDocument const &config, QFileInfo const &currentFile)
{
    QDomNodeList includes = config.elementsByTagName("include");
    for (unsigned i = 0; i < includes.length(); i++) {
        QDomElement includeElement = includes.at(i).toElement();
        QString includeName = includeElement.attribute("name");
        QFileInfo included = QFileInfo(currentFile.dir(), includeName);
        if (included.exists()) {
            load(included.canonicalFilePath());
        } else {
            fprintf(stderr, "Error 13 (%s:%d,%d) : Include '%s' is unknown.\n",
                    currentFile.fileName().toLatin1().constData(),
                    includeElement.lineNumber(),
                    includeElement.columnNumber(),
                    includeName.toLatin1().constData()
            );
        }

    }
}
开发者ID:Pechckin,项目名称:test,代码行数:20,代码来源:configLoader.cpp

示例5: registerDatabases

void Uic::registerDatabases( const QDomElement& e ) {
  QDomElement n;
  QDomNodeList nl;
  int i;
  nl = e.parentNode().toElement().elementsByTagName( "widget" );
  for ( i = 0; i < ( int ) nl.length(); ++i ) {
    n = nl.item( i ).toElement();
    QString conn = getDatabaseInfo( n, "connection" );
    QString tab = getDatabaseInfo( n, "table" );
    QString fld = getDatabaseInfo( n, "field" );
    if ( !conn.isNull() ) {
      dbConnections += conn;
      if ( !tab.isNull() ) {
        dbCursors[conn] += tab;
        if ( !fld.isNull() )
          dbForms[conn] += tab;
      }
    }
  }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:20,代码来源:uic.cpp

示例6: findElementbyUUID

QDomElement BookmarkWidget::findElementbyUUID(QDomDocument& doc, QString uuid, int type, const QString xmlPath)
{
    QString path;
    if (xmlPath == QString())
        path = getBookmarkFilepath();
    else
        path = xmlPath;
    QFile file(path);
    if(!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
        qDebug()<<"File cannot be opened.";
        showFileOpenError();
        file.close();
        return doc.createElement(QString());
    }

    doc.setContent(&file);
    QDomNodeList list = doc.elementsByTagName(BOOKMARK_XML_ROOT);
    if(list.isEmpty()) {
        showInvalidFileError();
        file.close();
        return doc.createElement(QString());
    }

    QDomElement root = list.at(0).toElement();
    QDomNodeList nodes;
    if(type == BOOKMARK) nodes = root.elementsByTagName(BOOKMARK_NAME);
    else if(type == FOLDER) nodes = root.elementsByTagName(FOLDER_NAME);

    QDomElement elt;
    QString value;
    for(int i = 0; i < nodes.length(); i++) {
        elt = nodes.at(i).toElement();
        value = elt.attribute(UUID_NAME);

        if(value == uuid) break;
        value.clear();
    }
    file.close();
    if(!value.isEmpty()) return elt;
    else return doc.createElement(QString());
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:41,代码来源:bookmarkWidget.cpp

示例7: fromXml

void WargearList::fromXml(const QDomElement& ele) throw(XmlParseException)
{
    QDomNodeList list = ele.childNodes();
    int len = list.length();
    QDomElement current;
    
    for(int i = 0; i < len; i++)
    {
        current = list.item(i).toElement();
        if(!current.isNull())
        {
            if(current.nodeName() == "wargear")
            {
                Wargear wg(current, race());
                m_wargears.insert(wg.id(), wg);
            }
            else
                throw XmlParseException("invalid wargear list node", current);
        }
    }
}
开发者ID:ameily,项目名称:WarRoom,代码行数:21,代码来源:WargearList.cpp

示例8: findPackageElement

QDomElement findPackageElement(
	const QDomDocument &list, QString packageType, QString packageName, QString mapName )
{
	QDomNodeList packageNodeList = list.elementsByTagName( packageType );

	for( unsigned int i=0; i < packageNodeList.length(); i++ )
	{
		QDomElement package = packageNodeList.at( i ).toElement();

		if( packageType == "map" && package.attribute( "name" ) == packageName )
				return package;

		if( packageType == "module" && package.attribute( "name" ) == packageName )
		{
			if( package.parentNode().parentNode().toElement().attribute( "name" ) == mapName )
				return package;
		}
	}

	return QDomElement();
}
开发者ID:Karry,项目名称:monavsailfish,代码行数:21,代码来源:main.cpp

示例9: readStylus

void XmlLoader::readStylus(QDomElement const &stylus)
{
    QDomNodeList stylusAttributes = stylus.childNodes();

    Stylus* stylusItem = new Stylus(0, 0, NULL);
    for (unsigned i = 0; i < stylusAttributes.length(); ++i) {
        QDomElement type = stylusAttributes.at(i).toElement();
        if (type.tagName() == "line") {
            QRectF rect = readRectOfXandY(type);
            Line* item = new Line(rect.left(), rect.top(), rect.right(), rect.bottom(), NULL);
            item->readPenBrush(type);
            stylusItem->mListLine.push_back(item);
            stylusItem->setPen(item->pen());
            stylusItem->setBrush(item->brush());
        }
        else
            qDebug() << "Incorrect stylus tag";
    }
    mScene->addItem(stylusItem);
    mScene->setZValue(stylusItem);
}
开发者ID:nfrey,项目名称:qreal,代码行数:21,代码来源:xmlLoader.cpp

示例10: getFormattedVacancy

QString TextFormatter::getFormattedVacancy(QDomNode vacancyNode)
{
    QDomNodeList itemChildNodes = vacancyNode.childNodes();
    QString formattedVacancy = "";

    for(int i = 0; i < itemChildNodes.length(); i++)
    {
        QDomNode currentNode = itemChildNodes.at(i);
        QString nodeName = currentNode.nodeName();

        if(nodeName.compare("title") == 0)
        {
            formattedVacancy += getFormattedTitle(currentNode);
        }
        else if(nodeName.compare("section") == 0)
        {
            formattedVacancy += getFormattedSection(currentNode);
        }
    }
    return formattedVacancy;
}
开发者ID:JStroom,项目名称:entersignage,代码行数:21,代码来源:textformatter.cpp

示例11: getFormattedItem

QString TextFormatter::getFormattedItem(QDomNode itemNode)
{
    QDomNodeList itemChildNodes = itemNode.childNodes();
    QString formattedItem = "";

    for(int i = 0; i < itemChildNodes.length(); i++)
    {
        QDomNode currentNode = itemChildNodes.at(i);
        QString nodeName = currentNode.nodeName();

        if(nodeName.compare("title") == 0)
        {
            formattedItem += getFormattedTitle(currentNode);
        }
        else if(nodeName.compare("description") == 0)
        {
            formattedItem += getFormattedDescription(currentNode);
        }
    }
    return formattedItem;
}
开发者ID:JStroom,项目名称:entersignage,代码行数:21,代码来源:textformatter.cpp

示例12: getFormattedChannel

QString TextFormatter::getFormattedChannel(QDomNode channelNode)
{
    QDomNodeList itemChildNodes = channelNode.childNodes();
    QString formattedChannel = "";

    for(int i = 0; i < itemChildNodes.length(); i++)
    {
        QDomNode currentNode = itemChildNodes.at(i);
        QString nodeName = currentNode.nodeName();

        if(nodeName.compare("item") == 0)
        {
            formattedChannel += getFormattedItem(currentNode);
        }
    }

    formattedChannel.append("<br/>");
    formattedChannel.append("<br/>");

    return formattedChannel;
}
开发者ID:JStroom,项目名称:entersignage,代码行数:21,代码来源:textformatter.cpp

示例13:

void
WidgetVpzPropertyObservables::refresh()
{

    bool oldBlock = QComboBox::blockSignals(true);
    QComboBox::clear();
    QString dyn = mVpz->modelDynFromDoc(mModQuery);
    QDomNodeList obss = mVpz->obssListFromObss(mVpz->obsFromDoc());
    QComboBox::addItem("<none>");
    int selectIndex = 0;
    for (int i = 0; i < obss.length(); i++) {
        QDomNode obs = obss.at(i);
        QString obsName = DomFunctions::attributeValue(obs, "name");
        QComboBox::addItem(obsName);
        if (mVpz->modelObsFromDoc(mModQuery) == obsName) {
            selectIndex = i + 1;
        }
    }
    QComboBox::setCurrentIndex(selectIndex);
    QComboBox::blockSignals(oldBlock);
}
开发者ID:Chabrier,项目名称:vle,代码行数:21,代码来源:widgetvpzproperty.cpp

示例14: indexRecognition

// Index any resources
void IndexRunner::indexRecognition(qint32 lid, Resource &r) {

    if (!keepRunning || pauseIndexing) {
        indexTimer->start();
        return;
    }

    // Make sure we have something to look through.
    Data recognition;
    if (r.recognition.isSet())
        recognition = r.recognition;
    if (!recognition.body.isSet())
        return;

    QDomDocument doc;
    QString emsg;
    doc.setContent(recognition.body, &emsg);

    // look for text tags
    QDomNodeList anchors = doc.documentElement().elementsByTagName("t");

    for (unsigned int i=0; keepRunning && !pauseIndexing && i<anchors.length(); i++) {
        QApplication::processEvents();
        QDomElement enmedia = anchors.at(i).toElement();
        QString weight = enmedia.attribute("w");
        QString text = enmedia.text();
        if (text != "") {
            IndexRecord *rec = new IndexRecord();
            rec->weight = weight.toInt();
            rec->lid = lid;
            rec->content = text;
            rec->source = "recognition";
            if (indexHash->contains(lid)) {
                delete indexHash->value(lid);
                indexHash->remove(lid);
            }
            indexHash->insert(lid, rec);
        }
    }
}
开发者ID:turbochad,项目名称:Nixnote2,代码行数:41,代码来源:indexrunner.cpp

示例15: take

//NOTE: This task watch for pre-JEP session.
bool JingleWatchSessionTask::take(const QDomElement &element)
{
	if(element.tagName() != "iq")
		return false;
	
	QString sessionType, initiator;
	
	QDomElement first = element.firstChild().toElement();
	if( !first.isNull() && first.attribute("xmlns") == JINGLE_NS && first.tagName() == "session" ) 
	{
		kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Checking for incoming sesssion." << endl;
		initiator = first.attribute("initiator");
	
		// Only proceed initiate type Jingle XMPP call.
		if( first.attribute("type") != QString::fromUtf8("initiate") )
			return false;
		
		int nodeIndex;

		QDomNodeList nodeList = first.childNodes();
		// Do not check first child
		for(nodeIndex = 0; nodeIndex < nodeList.length(); nodeIndex++)
		{
			QDomElement nodeElement = nodeList.item(nodeIndex).toElement();
			if(nodeElement.tagName() == "description")
			{
				sessionType = nodeElement.attribute("xmlns");
			}
		}

		if( !initiator.isEmpty() && !sessionType.isEmpty() )
		{
			kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Emmiting incoming sesssion." << endl;
			emit watchSession(sessionType, initiator);
			return true;
		}
	}
	
	return false;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:41,代码来源:jinglewatchsessiontask.cpp


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