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


C++ QDomNamedNodeMap类代码示例

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


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

示例1: LoadContent

void DialogEditNodeTable::LoadContent()
{
    //Load the element value
    m_pValueLine->setText(m_node.toElement().text());

    //Get all the attributes
    QDomNamedNodeMap attributes = m_node.attributes();

    m_pTable->setRowCount(attributes.size());

    QTableWidgetItem* item = 0;

    //Add each attribute in to the table
    for(int indexRow=0; indexRow < attributes.size(); ++indexRow)
    {
        int columnIndex = 0;

        QDomAttr attributeNode = attributes.item(indexRow).toAttr();

        item = new QTableWidgetItem(attributeNode.nodeName());// << attribute name
        item->setToolTip(attributeNode.nodeName());
        m_pTable->setItem(indexRow, columnIndex, item);
        columnIndex++;

        item = new QTableWidgetItem(attributeNode.nodeValue());// << value
        item->setToolTip(attributeNode.nodeValue());
        m_pTable->setItem(indexRow, columnIndex, item);
        columnIndex++;
    }

}
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:31,代码来源:DialogEditNodeTable.cpp

示例2: setArgs

void GTest_RunCMDLine::setArgs(const QDomElement & el) {
    QString commandLine;
    QDomNamedNodeMap map = el.attributes();
    int mapSz = map.length();
    for( int i = 0; i < mapSz; ++i ) {
        QDomNode node = map.item(i);
        if(node.nodeName() == "message"){
            expectedMessage = node.nodeValue();
            continue;
        }
        if(node.nodeName() == "nomessage"){
            unexpectedMessage = node.nodeValue();
            continue;
        }
        if(node.nodeName() == WORKINK_DIR_ATTR){
            continue;
        }
        QString argument = "--" + node.nodeName() + "=" + getVal(node.nodeValue());
         if( argument.startsWith("--task") ) {
            args.prepend(argument);
            commandLine.prepend(argument + " ");
        } else {
            args.append(argument);
            commandLine.append(argument + " ");
        }
    }
    args.append("--log-level-details");
    args.append("--lang=en");
    args.append("--log-no-task-progress");
    commandLine.append(QString(" --log-level-details --lang=en --log-no-task-progress"));
    cmdLog.info(commandLine);
}
开发者ID:m-angelov,项目名称:ugene,代码行数:32,代码来源:CMDLineTests.cpp

示例3: QVariant

//! [3]
QVariant DomModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (role != Qt::DisplayRole)
        return QVariant();

    DomItem *item = static_cast<DomItem*>(index.internalPointer());

    QDomNode node = item->node();
//! [3] //! [4]
    QStringList attributes;
    QDomNamedNodeMap attributeMap = node.attributes();

    switch (index.column()) {
        case 0:
            return node.nodeName();
        case 1:
            for (int i = 0; i < attributeMap.count(); ++i) {
                QDomNode attribute = attributeMap.item(i);
                attributes << attribute.nodeName() + "=\""
                              +attribute.nodeValue() + "\"";
            }
            return attributes.join(" ");
        case 2:
            return node.nodeValue().split("\n").join(" ");
        default:
            return QVariant();
    }
}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:32,代码来源:dommodel.cpp

示例4: LOG_ERROR_FOR

/** Construct an DrugDrugInteraction object using the XML QDomElement. */
DrugDrugInteraction::DrugDrugInteraction(const QDomElement &element)
{
    if (element.tagName()!="DDI") {
        LOG_ERROR_FOR("DrugDrugInteraction", "Wrong XML Element");
    } else {
        m_Data.insert(FirstInteractorName, Constants::correctedUid(Utils::removeAccents(element.attribute("i1"))));
        m_Data.insert(SecondInteractorName, Constants::correctedUid(Utils::removeAccents(element.attribute("i2"))));
        m_Data.insert(FirstInteractorRouteOfAdministrationIds, element.attribute("i1ra").split(";"));
        m_Data.insert(SecondInteractorRouteOfAdministrationIds, element.attribute("i2ra").split(";"));
        m_Data.insert(LevelCode, element.attribute("l"));
        m_Data.insert(LevelName, ::levelName(element.attribute("l")));
        m_Data.insert(DateCreation, QDate::fromString(element.attribute("a", QDate(2010,01,01).toString(Qt::ISODate)), Qt::ISODate));
        m_Data.insert(DateLastUpdate, QDate::fromString(element.attribute("lu", QDate(2010,01,01).toString(Qt::ISODate)), Qt::ISODate));
        m_Data.insert(IsValid, element.attribute("v", "1").toInt());
        m_Data.insert(IsReviewed, element.attribute("rv", "0").toInt());
        if (!element.attribute("p").isEmpty())
            m_Data.insert(PMIDsStringList, element.attribute("p").split(";"));
        m_Data.insert(IsDuplicated, false);
        // Read Risk
        QDomElement risk = element.firstChildElement("R");
        while (!risk.isNull()) {
            setRisk(risk.attribute("t"), risk.attribute("l"));
            risk = risk.nextSiblingElement("R");
        }
        // Read Management
        QDomElement management = element.firstChildElement("M");
        while (!management.isNull()) {
            setManagement(management.attribute("t"), management.attribute("l"));
            management = management.nextSiblingElement("M");
        }
        // Read Dose related interactions
        QDomElement dose = element.firstChildElement("D");
        while (!dose.isNull()) {
            DrugDrugInteractionDose *ddidose = 0;
            if (dose.attribute("i") == "1") {
                ddidose = &m_FirstDose;
            } else {
                ddidose = &m_SecondDose;
            }
            if (dose.attribute("uf").toInt()==1) {
                ddidose->setData(DrugDrugInteractionDose::UsesFrom, true);
                ddidose->setData(DrugDrugInteractionDose::FromValue , dose.attribute("fv"));
                ddidose->setData(DrugDrugInteractionDose::FromUnits, dose.attribute("fu"));
                ddidose->setData(DrugDrugInteractionDose::FromRepartition , dose.attribute("fr"));
            } else if (dose.attribute("ut").toInt()==1) {
                ddidose->setData(DrugDrugInteractionDose::UsesTo, true);
                ddidose->setData(DrugDrugInteractionDose::ToValue , dose.attribute("tv"));
                ddidose->setData(DrugDrugInteractionDose::ToUnits, dose.attribute("tu"));
                ddidose->setData(DrugDrugInteractionDose::ToRepartition , dose.attribute("tr"));
            }
            dose = dose.nextSiblingElement("D");
        }
        // Read formalized risk
        QDomElement form = element.firstChildElement("F");
        QDomNamedNodeMap attributeMap = form.attributes();
        for(int i=0; i < attributeMap.size(); ++i) {
            addFormalized(attributeMap.item(i).nodeName(), form.attribute(attributeMap.item(i).nodeName()));
        }
    }
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:61,代码来源:drugdruginteraction.cpp

示例5: initPins

void ComponentItem::initPins()
{
    QDomNode pinsNode;
    QDomNodeList list = m_svgDocument.elementsByTagName("g");
    for (int i=0;i<list.count();i++){
        QDomNamedNodeMap attrs = list.item(i).attributes();
        if (attrs.contains("id") &&
            attrs.namedItem("id").toAttr().value() == QString("pins")){
            pinsNode = list.item(i);
            break;
        }
    }
    if (pinsNode.isNull() || !pinsNode.hasChildNodes()){
        kWarning() << "No pins definition found for this component";
        return;
    }
    QDomElement pin = pinsNode.firstChildElement();
    while (!pin.isNull()) {
        QRectF pinRect;
        double r = pin.attribute("r").toDouble();
        pinRect.setLeft(pin.attribute("cx").toDouble());
        pinRect.setTop(pin.attribute("cy").toDouble());
        pinRect.setWidth(r*2);
        pinRect.setHeight(r*2);
        PinItem* p = new PinItem(pinRect, this, qobject_cast< IDocumentScene* >(scene()));
        p->setId(pin.attribute("id"));
        pin = pin.nextSiblingElement();
    }
}
开发者ID:Munrek,项目名称:ktechlab,代码行数:29,代码来源:componentitem.cpp

示例6: copyAttributes

void DefinitionParser::copyAttributes (AssetBit* asset, const QDomNamedNodeMap& attributes) const
{
	asset->x = attributes.namedItem(ATTR_X).nodeValue();
	asset->y = attributes.namedItem(ATTR_Y).nodeValue();
	asset->alpha = attributes.namedItem(ATTR_ALPHA).nodeValue();
	asset->visible = attributes.namedItem(ATTR_VISIBLE).nodeValue();
}
开发者ID:hkunz,项目名称:createswf,代码行数:7,代码来源:DefinitionParser.cpp

示例7: findAddOnHeader

//copyright : (C) 2002-2004 InfoSiAL S.L.
//email     : [email protected]
void MReportEngine::drawAddOnHeader(MPageCollection *pages, int level,
                                    QPtrList<QMemArray<double> > *gDT,
                                    QValueVector<QString> *gDTS)
{
  MReportSection *header = findAddOnHeader(level);

  if (header) {
    QDomNode record = records.item(currRecord_);

    if (!header->mustBeDrawed(&record))
      return;

    header->setPageNumber(currPage);
    header->setReportDate(currDate);

    if ((currY + header->getHeight()) > currHeight)
      newPage(pages);

    QString value;
    QDomNamedNodeMap fields = record.attributes();

    for (int i = 0; i < header->getFieldCount(); i++) {
      value = fields.namedItem(header->getFieldName(i)).nodeValue();
      header->setFieldData(i, value, &record, fillRecords_);
    }

    if (gDT && level > -1)
      header->setCalcFieldData(gDT, gDTS, &record, fillRecords_);
    header->setCalcFieldDataGT(grandTotal);

    int sectionHeight = header->getHeight();
    header->draw(p, leftMargin, currY, sectionHeight);
    currY += sectionHeight;
  }
}
开发者ID:afibanez,项目名称:eneboo,代码行数:37,代码来源:mreportengine.cpp

示例8: setName

void ViElement::fromDom(QDomNode &dom)
{
	setName(dom.toElement().tagName());
	QDomNamedNodeMap attributes = dom.attributes();
	for(int i = 0; i < attributes.size(); ++i)
	{
		addAttribute(ViAttribute(attributes.item(i).nodeName(), attributes.item(i).nodeValue()));
	}
	QDomNodeList children = dom.childNodes();
	if(children.size() > 0)
	{
		for(int i = 0; i < children.size(); ++i)
		{
			if(children.item(i).isText())
			{
				setValue(children.item(i).nodeValue());
			}
			else
			{
				ViElement child;
				QDomNode node = children.item(i);
				child.fromDom(node);
				addChild(child);
			}
		}
	}
	else
	{
		setValue(dom.nodeValue());
	}
}
开发者ID:EQ4,项目名称:Visore,代码行数:31,代码来源:vielement.cpp

示例9: modify

void SvgImage::modify(const QString &tag, const QString &id, const QString &attribute,
                      const QString &value)
{
    bool modified = false;

    QDomNodeList nodeList = m_svgDocument.elementsByTagName( tag );
    for ( int i = 0; i < nodeList.count(); ++i )
    {
        QDomNode node = nodeList.at( i );
        QDomNamedNodeMap attributes = node.attributes();
        if ( checkIDAttribute( attributes, id ) )
        {
            QDomNode attrElement = attributes.namedItem( attribute );
            if ( attrElement.isAttr() )
            {
                QDomAttr attr = attrElement.toAttr();
                attr.setValue( value );
                modified = true;
            }
        }
    }

    if ( modified )
    {
        m_updateNeeded = true;
        update();
    }
}
开发者ID:jordonwu,项目名称:qtquick_demo,代码行数:28,代码来源:svgimage.cpp

示例10: helperToXmlAddDomElement

static void helperToXmlAddDomElement(QXmlStreamWriter* stream, const QDomElement& element, const QStringList &omitNamespaces)
{
    stream->writeStartElement(element.tagName());

    /* attributes */
    QString xmlns = element.namespaceURI();
    if (!xmlns.isEmpty() && !omitNamespaces.contains(xmlns))
        stream->writeAttribute("xmlns", xmlns);
    QDomNamedNodeMap attrs = element.attributes();
    for (int i = 0; i < attrs.size(); i++)
    {
        QDomAttr attr = attrs.item(i).toAttr();
        stream->writeAttribute(attr.name(), attr.value());
    }

    /* children */
    QDomNode childNode = element.firstChild();
    while (!childNode.isNull())
    {
        if (childNode.isElement())
        {
            helperToXmlAddDomElement(stream, childNode.toElement(), QStringList() << xmlns);
        } else if (childNode.isText()) {
            stream->writeCharacters(childNode.toText().data());
        }
        childNode = childNode.nextSibling();
    }
    stream->writeEndElement();
}
开发者ID:unisontech,项目名称:qxmpp,代码行数:29,代码来源:QXmppServer.cpp

示例11: QLatin1Char

void WAccount::fillStrings(QString &text, QString &html, const QDomElement &element, const QString &prefix)
{
	QString key = prefix + QLatin1Char('%');
	if (key != QLatin1String("%%")) {
		text.replace(key, element.text());
		html.replace(key, element.text().toHtmlEscaped());
		qDebug() << key;
	}
	key.chop(1);

	QDomNamedNodeMap attributes = element.attributes();
	for (int i = 0; i < attributes.count(); ++i) {
		QDomNode attribute = attributes.item(i);
		QString attributeKey = key
				% QLatin1Char('/')
				% attribute.nodeName()
				% QLatin1Char('%');
		qDebug() << attributeKey;
		text.replace(attributeKey, attribute.nodeValue());
		html.replace(attributeKey, attribute.nodeValue().toHtmlEscaped());
	}

	if (!key.endsWith(QLatin1Char('%')))
		key += QLatin1Char('/');
	QDomNodeList elementChildren = element.childNodes();
	for (int i = 0; i < elementChildren.count(); ++i) {
		QDomNode node = elementChildren.at(i);
		if (node.isElement())
			fillStrings(text, html, node.toElement(), key + node.nodeName());
	}
}
开发者ID:CyberSys,项目名称:qutim,代码行数:31,代码来源:waccount.cpp

示例12: searchFinished

void WSettings::searchFinished(QNetworkReply *reply)
{
	reply->deleteLater();
	ui.addButton->setEnabled(true);
	ui.searchEdit->clear();

	QDomDocument doc;
	if (!doc.setContent(reply->readAll()))
		return;
	QDomElement rootElement = doc.documentElement();

	QDomNodeList locations = rootElement.elementsByTagName(QLatin1String("location"));
	if (locations.isEmpty())
		ui.searchEdit->addItem(tr("Not found"));
	for (int i = 0; i < locations.count(); i++) {
		QDomNamedNodeMap attributes = locations.at(i).attributes();
		QString cityId = attributes.namedItem(QLatin1String("location")).nodeValue();
		QString cityName = attributes.namedItem(QLatin1String("city")).nodeValue();
		QString stateName = attributes.namedItem(QLatin1String("state")).nodeValue();
		QString cityFullName = cityName + ", " + stateName;
		int index = ui.searchEdit->count();
		ui.searchEdit->addItem(cityFullName);
		ui.searchEdit->setItemData(index, cityId, CodeRole);
		ui.searchEdit->setItemData(index, cityName, CityRole);
		ui.searchEdit->setItemData(index, stateName, StateRole);
	}
}
开发者ID:CyberSys,项目名称:qutim,代码行数:27,代码来源:wsettings.cpp

示例13: QVariant

QVariant MetricDomModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (role != Qt::DisplayRole)
        return QVariant();

    DomItem *item = static_cast<DomItem*>(index.internalPointer());

    QDomNode node = item->node();

    QStringList attributes;
    QDomNamedNodeMap attributeMap = node.attributes();

    switch (index.column()) {
        case 0:
            return node.nodeName();
        case 1:
        	if( !attributeMap.contains("Type") ) {
        		return QVariant();
        	}
        	return attributeMap.namedItem("Type").nodeValue();
        case 2:
        	if( !attributeMap.contains("Format") ) {
        		return QVariant();
        	}
        	return attributeMap.namedItem("Format").nodeValue();
        default:
            return QVariant();
    }
}
开发者ID:DMachuca,项目名称:SGEMS-UQ,代码行数:32,代码来源:metricdommodel.cpp

示例14: cleanMathml

void cleanMathml(QDomElement pElement)
{
    // Clean up the current element
    // Note: the idea is to remove all the attributes that are not in the
    //       MathML namespace. Indeed, if we were to leave them in then the XSL
    //       transformation would either do nothing or, worst, crash OpenCOR...

    static const QString MathmlNamespace = "http://www.w3.org/1998/Math/MathML";

    QDomNamedNodeMap attributes = pElement.attributes();
    QList<QDomNode> nonMathmlAttributes = QList<QDomNode>();

    for (int i = 0, iMax = attributes.count(); i < iMax; ++i) {
        QDomNode attribute = attributes.item(i);

        if (attribute.namespaceURI().compare(MathmlNamespace))
            nonMathmlAttributes << attribute;
    }

    foreach (QDomNode nonMathmlAttribute, nonMathmlAttributes)
        pElement.removeAttributeNode(nonMathmlAttribute.toAttr());

    // Go through the element's child elements, if any, and clean them up

    for (QDomElement childElement = pElement.firstChildElement();
         !childElement.isNull(); childElement = childElement.nextSiblingElement()) {
        cleanMathml(childElement);
    }
}
开发者ID:nickerso,项目名称:opencor,代码行数:29,代码来源:corecliutils.cpp

示例15: removeNamedItem

QDomNode QDomNamedNodeMapProto:: removeNamedItem(const QString& name)
{
  QDomNamedNodeMap *item = qscriptvalue_cast<QDomNamedNodeMap*>(thisObject());
  if (item)
    return item->removeNamedItem(name);
  return QDomNode();
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:7,代码来源:qdomnamednodemapproto.cpp


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