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


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

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


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

示例1: getRowIndex

/** 
 * \en
 * insert new row in table and replace tag to value
 * \_en
 * \ru
 * Вставляет новую строку в таблицу, заменяет теги на значения, удаляет тег секции из строки таблицы.
 * Выполняет рекурсивный поиск узла, содержащего строку таблицы. У этого узла есть
 * специальное имя(w:r), которое распознается функцией. После того, как узел найден, строка строка дублируется, 
 * а из текущей строки удаляются все теги секции, чтобы избежать мнократного размножения строк таблицы.
 * \_ru
 * \param node - \en context for inserting \_en \ru узел, в который происходит вставка \_ru 
 * \see searchTags()
 */
void 
aMSOTemplate::insertRowValues(QDomNode node)
{
	QDomNode n = node;
	while(!n.parentNode().isNull())
	{
		n = n.parentNode();
		QDomElement e = n.toElement();
		if( n.nodeName()=="Row" ) 
		{	
			QDomAttr a = n.toElement().attributeNode( "ss:Index" );
			n.parentNode().insertAfter(n.cloneNode(true),n);
			clearTags(n,true);
			
			QMap<QString,QString>::Iterator it;
			for ( it = values.begin(); it != values.end(); ++it )
			{
				searchTags(n,it.key());
			}
			int rowIndex = a.value().toInt();
			if (rowIndex == 0) 
			{
				rowIndex = getRowIndex(n);
				n.toElement().setAttribute("ss:Index",rowIndex);	
			}
			n.nextSibling().toElement().setAttribute("ss:Index",rowIndex+1);	
		}
	}
}
开发者ID:app,项目名称:ananas-labs,代码行数:42,代码来源:amsotemplate.cpp

示例2: heightXML

void MainWindow::heightXML(QDomNode doc, int *height)
{
    if(!doc.isNull())
    {
        int heightCurrentNode = 0;
        QDomNode docParent = doc;
        while(!docParent.parentNode().isNull())
        {
            docParent = docParent.parentNode();
            heightCurrentNode++;
        }
        if(heightCurrentNode > *height)
        {
            *height = heightCurrentNode;
        }
        if(!doc.childNodes().isEmpty() && (doc.firstChild().toElement().tagName() != "" || doc.firstChild().isComment()))
        {
            QDomNodeList nodeList = doc.childNodes();

            for(int i = 0; i < nodeList.length(); i++)
            {
                heightXML(nodeList.at(i), height);
            }
        }
    }
}
开发者ID:lomsansnom,项目名称:IHM_OFELI,代码行数:26,代码来源:mainwindow.cpp

示例3:

/**
 * \en
 * Deletes row, having section tag
 * \_en
 * \ru
 * Рекурсивная функция. Удаляет строки, содержащие тег секции
 * \_ru
* \param node - \en context \_en \ru узел из которого нужно удалить строки \_ru
 */
void
aMSOTemplate::clearRow(QDomNode node)
{
QDomNode n = node.lastChild();
	while( !n.isNull() )
	{	
		if(n.isText())
		{
			QString str = n.nodeValue();
			QRegExp re;
			re.setPattern(QString("%1.*%2").arg(open_token_section).arg(close_token_section));
			re.setMinimal(true);
			int pos = re.search(str,0);
			if(pos!=-1)
			{
				QDomNode tmp = n;
				while(!tmp.parentNode().isNull())
				{
					tmp = tmp.parentNode();
					if( tmp.nodeName()=="Row" ) 
					{
						tmp.parentNode().removeChild(tmp);
						break;
					}
				}
			}
		}
		else
		{
			clearRow(n);
		}
		n = n.previousSibling();
	}	
}
开发者ID:app,项目名称:ananas-labs,代码行数:43,代码来源:amsotemplate.cpp

示例4: createMultiFrameSprite

bool DefinitionParser::createMultiFrameSprite (QDomNode& frame, const Content::Class clazz)
{
	QDomNode parent = frame.parentNode();
	QDomNamedNodeMap attributes = parent.attributes();
	const QString childName = clazz == Content::MOVIECLIP ? ::NODE_FRAME : ::NODE_OBJECT;
	const QString className = attributes.namedItem(ATTR_CLASS).nodeValue();
	const QString basePath = attributes.namedItem(ATTR_PATH).nodeValue();
	const QString absBasePath = _targetDir.absoluteFilePath(basePath);
	struct SpriteAsset* sprite = NULL;

	if (!QFile::exists(absBasePath)) {
		info("base path \'" + absBasePath + "\' does not exist");
		return false;
	}

	while (!frame.isNull()) {
		QDomElement e = frame.toElement();
		QDomNamedNodeMap attr = frame.attributes();
		checkAttributes(frame);
		frame = frame.nextSibling();

		if (e.isNull()) {
			continue;
		}

		const QString tn = e.tagName();
		if (tn != childName) {
			warnInvalidTag(tn, frame.parentNode().nodeName());
			continue;
		}

		const QString relpath = attr.namedItem(ATTR_PATH).nodeValue();
		if (attr.isEmpty() || relpath.isEmpty()) {
			warnMissingAttr(ATTR_PATH, tn);
			continue;
		}

		const QString path = _targetDir.absoluteFilePath(basePath + relpath);
		if (!checkPathExists(path)) {
			continue;
		}
		struct AssetBit asset;
		asset.name = attr.namedItem(ATTR_NAME).nodeValue();
		asset.path = _tempDir.relativeFilePath(path);
		copyAttributes(&asset, attr);
		if (!sprite) {
			sprite = new SpriteAsset();
		}
		sprite->assets.push_back(asset);
	}
	if (sprite) {
		sprite->clazz = clazz;
		sprite->name = className;
		copyAttributes(sprite, attributes);
		_assets[className] = sprite;
	}
	return true;
}
开发者ID:hkunz,项目名称:createswf,代码行数:58,代码来源:DefinitionParser.cpp

示例5: ClearValue

void XmlConfiguration::ClearValue( const QString &sSetting )
{
    QDomNode node = FindNode(sSetting);
    if (!node.isNull())
    {
        QDomNode parent = node.parentNode();
        parent.removeChild(node);
        while (parent.childNodes().count() == 0)
        {
            QDomNode next_parent = parent.parentNode();
            next_parent.removeChild(parent);
            parent = next_parent;
        }
    }
}
开发者ID:jhludwig,项目名称:mythtv,代码行数:15,代码来源:configuration.cpp

示例6: QDomNode

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

示例7: getFullPath

/**
 * Returns the path to the given XML Element in the document,
 * Example:
 *  <elem1>
 *    <elem2 />
 *  </elem1>
 *  
 *  Input: elem2
 *  Output: "elem1/elem2"
 * 
 * @return QString with the path to to the QDomElement.
 */
QString XMLConfigLoader::getFullPath(const QDomElement &element)
{
  QString path = element.tagName();
  
  QDomNode parent = element.parentNode();
  while(!parent.isNull())
  {
    if(parent.isElement() && !parent.parentNode().isDocument())
    {
      path = path.prepend(parent.toElement().tagName() + "/");
    }
    parent = parent.parentNode();
  }
  
  return path;
}
开发者ID:nerd-toolkit,项目名称:nerd,代码行数:28,代码来源:XMLConfigLoader.cpp

示例8: hasParentNode

bool hasParentNode(const QDomNode& n, const QString& name)
{
    QDomNode p = n.parentNode();
    if (p.isNull()) return false;
    if (p.nodeName() == name) return true;
    return hasParentNode(p, name);
}
开发者ID:Angstrom-distribution,项目名称:meta-kde4,代码行数:7,代码来源:recordsxml2cpp.cpp

示例9:

bool KFormula13ContentHandler::endElement(const QString&,
        const QString& localName,
        const QString&)
{
    if (localName == "CONTENT" || localName == "FORMULASETTINGS" ||
            localName == "FORMULA" || localName == "DENOMINATOR" ||
            localName == "NUMERATOR" || localName == "TEXT")
        return true;

    if (localName == "MATRIX")     // a matrix has been completely parsed
        m_matrixStack.pop();

    if (localName == "SEQUENCE" && m_currentElement.tagName() == "mtext" &&
            m_currentElement.parentNode().childNodes().count() == 1) {
        QDomNode parent = m_currentElement.parentNode();
        parent.parentNode().appendChild(m_currentElement);
        m_currentElement.parentNode().removeChild(parent);
    }

    m_currentElement = m_currentElement.parentNode().toElement();

    if (m_currentElement.tagName() == "mtd")  // move up to trigger mtr in parseMatrix()
        m_currentElement = m_currentElement.parentNode().toElement();

    return true;
}
开发者ID:KDE,项目名称:koffice-formulashape,代码行数:26,代码来源:KFormula13ContentHandler.cpp

示例10: createConstant

void DataBackend::createConstant(QDomNode d_)
{
	if(d_.parentNode().nodeName()=="fizzix_object") return;
	QDomElement d=d_.toElement();
	QString name = d.attribute("name");
	constants->setElement(name, Parser::parseFizdatum(d.text(),((Type)(d.attribute("type").toInt()))));
}
开发者ID:purnimab,项目名称:fizzix,代码行数:7,代码来源:databackend.cpp

示例11: setprojContent

void projectviewer::setprojContent(QFile* input)
{
	QString err_msg; int err_line; int err_column;
	doc.clear();
	clear();
	bool set_cont = doc.setContent(input, &err_msg, &err_line, &err_column);
	if (!set_cont)
	{
		emit(errorOpeningFile(qPrintable(err_msg), err_line, err_column));
		return;
	}

	QStandardItem *parentItem = invisibleRootItem();
	addNode(&doc.firstChild().firstChild().firstChild(), parentItem);
	
// -------- add cwd entry if necessary
	char dummy[300];
	if (setXMLEntry(&doc, "workingDirectory", dummy))
	{
		QDomNode currentItem = doc.elementsByTagName("workingDirectory").item(0);
		QDomNode parrent = currentItem.parentNode();
		parrent.removeChild(currentItem);
	}
		QDomElement newelement = doc.createElement("workingDirectory");
		QDomText newnodetext = doc.createTextNode(QDir::current().absolutePath());
		newelement.appendChild(newnodetext);
		doc.firstChild().firstChild().appendChild(newelement);

// ----------

}
开发者ID:MPiotr,项目名称:slowwavedevice,代码行数:31,代码来源:projectviewer.cpp

示例12: nodeToVariant

//! function
static bool nodeToVariant(const QDomNode &aNode,QVariant &aValue) {
    bool vRetval = false;
    QString vType, vValue;

    aValue = QVariant();
    if(!vRetval && aNode.isCDATASection()) {
        vValue = aNode.toCDATASection().data();
        vRetval = true;
    }

    if(!vRetval && aNode.isText()) {
        vValue = aNode.toText().data();
        vRetval = true;
    }

    if(!vRetval) return vRetval;
    if(vValue.isEmpty()) return false; // ????

    const QDomNode vParent = aNode.parentNode();
    if(vParent.isElement()) {
        vType = vParent.toElement().attribute(QString::fromLatin1("type"));
    }

    if(vType == QString::fromLatin1("bytearray")) {
        aValue = QVariant(vValue.toLatin1());
    }
    else if(vType == QString::fromLatin1("variant")) {
        QByteArray vArray(vValue.toLatin1());
        QDataStream vStream(&vArray, QIODevice::ReadOnly);
        vStream >> aValue;
    }
开发者ID:gbrault,项目名称:firtool,代码行数:32,代码来源:qxmlsettings.cpp

示例13: fixAttribute

/*
    \internal
*/
void DomTool::fixAttribute(QDomNode &node, double version)
{
    QString tagName =  node.toElement().tagName();
    if (tagName == QLatin1String("widget")) {
        QString clss = node.toElement().attribute(QLatin1String("class"));
        for (int i = 0; i < widgs; ++i)
            if ((version < widgetTable[i].version)
                 && (clss == widgetTable[i].before)) {
                node.toElement().setAttribute(QLatin1String("class"), propertyTable[i].after);
                return;
            }
        return;
    }
    if (tagName == QLatin1String("property")) {
        QDomElement e = node.parentNode().toElement();
        QString clss = e.attribute(QLatin1String("class"));
        QString name = node.toElement().attribute(QLatin1String("name"), QLatin1String(""));
        for (int i = 0; i < props; ++i)
            if ((version < propertyTable[i].version)
                 && (clss == propertyTable[i].clss)
                 && (propertyTable[i].before.isNull()
                      || name == propertyTable[i].before)) {
                node.toElement().setAttribute(QLatin1String("name"), propertyTable[i].after);
                return;
            }
    }
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例14: procesaOperador

/**
\param operador
\return
**/
bool BcCuentasAnualesImprimirView::procesaOperador ( const QDomNode &operador )
{
    BL_FUNC_DEBUG
    QDomElement valor = operador.firstChildElement ( "VALORACT" );
    if ( !valor.isNull() )
        return true;
    /// Miramos la f&oacute;rmula.
    QDomElement lineaid = operador.firstChildElement ( "LINEAID" );

    if ( !lineaid.isNull() ) {
        QDomNodeList litems = m_doc.elementsByTagName ( "ID" );
        for ( int i = 0; i < litems.count(); i++ ) {
            QDomNode item = litems.item ( i );
            QDomElement e1 = item.toElement(); /// Try to convert the node to an element.
            if ( !e1.isNull() ) { /// The node was really an element.
                if ( e1.text() == lineaid.text() ) {
                    /// Este item es la f&oacute;rmula referenciada.
                    QDomNode formula = item.parentNode().firstChildElement ( "FORMULA" );
                    QString valoract, valorant;
                    if ( valorItem ( formula, valoract, valorant ) ) {
                        agregaValores ( operador, valoract, valorant );
                        return true;
                    } else {
                        return false;
                    } // end if
                } // end if
            } // end if
        } // end for
    } // end if

    
    return false;
}
开发者ID:JustDevZero,项目名称:bulmages,代码行数:37,代码来源:bccuentasanualesimprimirview.cpp

示例15: procesaFormula

/**
\param formula
\param return
\return
**/
bool BcCuentasAnualesImprimirView::procesaFormula ( const QDomNode &formula )
{
    BL_FUNC_DEBUG
    QDomElement valor = formula.firstChildElement ( "VALORACT" );
    //
    QString valors = valor.toElement().text();
    QString codigo = formula.parentNode().firstChildElement ( "CONCEPTO" ).toElement().text();
    //
    if ( !valor.isNull() ) {
        return true;
    } // end if
    BlFixed tvaloract = BlFixed ( "0.0" );
    BlFixed tvalorant = BlFixed ( "0.0" );
    QDomElement formula3 = formula.toElement();
    QDomNodeList litems = formula3.elementsByTagName ( "OPERADOR" );
    for ( int i = 0; i < litems.count(); i++ ) {
        QDomNode item = litems.item ( i );
        QDomElement e1 = item.toElement(); /// Try to convert the node to an element.
        if ( !e1.isNull() ) { /// The node was really an element.
            if ( !procesaOperador ( item ) )
                return false;
            QString valoract, valorant;
            if ( valorItem ( item, valoract, valorant ) ) {
                tvaloract = tvaloract + BlFixed ( valoract );
                tvalorant = tvalorant + BlFixed ( valorant );
            } else
                return false;
        } // end if
    } // end for
    QString tvaloracts = tvaloract.toQString();
    QString tvalorants = tvalorant.toQString();
    agregaValores ( formula, tvaloracts, tvalorants );
    
    return true;
}
开发者ID:JustDevZero,项目名称:bulmages,代码行数:40,代码来源:bccuentasanualesimprimirview.cpp


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