本文整理汇总了C++中QDomNode::nodeName方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::nodeName方法的具体用法?C++ QDomNode::nodeName怎么用?C++ QDomNode::nodeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNode
的用法示例。
在下文中一共展示了QDomNode::nodeName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
QString QDomNodeProto:: nodeName() const
{
QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
if (item)
return item->nodeName();
return QString();
}
示例2: setVpz
void
fileVpzView::onUndoRedoVpz(QDomNode oldValVpz,
QDomNode newValVpz,
QDomNode oldValVpm,
QDomNode newValVpm)
{
if (newValVpz.nodeName() == "vle_project") {
setVpz(mVpz);
return;
}
QString tab = getCurrentTab();
if (tab == "Diagram") {
mScene.onUndoRedoVpz(oldValVpz, newValVpz, oldValVpm, newValVpm);
} else if (tab == "Conditions") {
mExpCondTab->onUndoRedoVpz(oldValVpz, newValVpz, oldValVpm, newValVpm);
} else if (tab == "Dynamics") {
mDynamicsTab->onUndoRedoVpz(
oldValVpz, newValVpz, oldValVpm, newValVpm);
} else if (tab == "Observables") {
mObservablesTab->onUndoRedoVpz(
oldValVpz, newValVpz, oldValVpm, newValVpm);
} else if (tab == "Views") {
mExpViewTab->onUndoRedoVpz(oldValVpz, newValVpz, oldValVpm, newValVpm);
} else if (tab == "Classes") {
mClassesTab->onUndoRedoVpz(oldValVpz, newValVpz, oldValVpm, newValVpm);
} else if (tab == "Simulation") {
// mSimTab->onUndoRedoVpz(oldValVpz, newValVpz,
// oldValVpm, newValVpm);
} else if (tab == "Project") {
mProjectTab->onUndoRedoVpz(oldValVpz, newValVpz, oldValVpm, newValVpm);
}
}
示例3: copyMetaData
void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &metaDataDir,
const PackageInfoVector &packages, const QString &appName, const QString &appVersion)
{
const QString targetDir = makePathAbsolute(_targetDir);
if (!QFile::exists(targetDir))
QInstaller::mkpath(targetDir);
QDomDocument doc;
QDomElement root;
QFile existingUpdatesXml(QFileInfo(metaDataDir, QLatin1String("Updates.xml")).absoluteFilePath());
if (existingUpdatesXml.open(QIODevice::ReadOnly) && doc.setContent(&existingUpdatesXml)) {
root = doc.documentElement();
// remove entry for this component from existing Updates.xml, if found
foreach (const PackageInfo &info, packages) {
const QDomNodeList packageNodes = root.childNodes();
for (int i = packageNodes.count() - 1; i >= 0; --i) {
const QDomNode node = packageNodes.at(i);
if (node.nodeName() != QLatin1String("PackageUpdate"))
continue;
if (node.firstChildElement(QLatin1String("Name")).text() != info.name)
continue;
root.removeChild(node);
}
}
existingUpdatesXml.close();
} else {
示例4: drawNode
void PcbXML::drawNode(QDomNode node){
DebugDialog::debug("drawing node:");
QString tag = node.nodeName().toLower();
if(tag=="pin"){
DebugDialog::debug("\tPin");
drawPin(node);
}
else if(tag=="pad"){
DebugDialog::debug("\tPad");
drawPad(node);
}
else if(tag=="elementline"){
DebugDialog::debug("\tElementLine");
drawElementLine(node);
}
else if(tag=="elementarc"){
DebugDialog::debug("\tElementArc");
drawElementArc(node);
}
else if(tag=="mark"){
DebugDialog::debug("\tMark");
drawMark(node);
}
else {
DebugDialog::debug("cannot draw - unrecognized tag");
}
}
示例5: readTypeInfo
/************************************************************
* 功能 : 从type_property.xml中读取type和property的配置信息
* 输入 :
* 返回值 : void
*************************************************************/
void CreatModel::readTypeInfo()
{
openXml(QDir::currentPath() + "/Config/type_property.xml");
QDomNode n = m_root.firstChild();
while(!n.isNull())
{
QString nodeName = n.nodeName();
if (nodeName == "typelist")
{
QDomNode m = n.toElement().firstChild();
while (m.isElement())
{
QString nameValue = m.toElement().attributeNode("name").value();
m_typeList.append(nameValue);
m = m.nextSibling();
}
}
if (nodeName == "propertylist")
{
QDomNode m = n.toElement().firstChild();
while (m.isElement())
{
QString nameValue = m.toElement().attributeNode("name").value();
m_propertyList.append(nameValue);
m = m.nextSibling();
}
}
n = n.nextSibling();
}
}
示例6:
bool CAnm2DXml::loadLayers(QDomNode node, AnmLayer *pParent)
{
while ( !node.isNull() ) {
if ( node.nodeName() == kAnmXML_ID_Layer ) {
QDomNamedNodeMap nodeMap = node.attributes() ;
if ( nodeMap.namedItem(kAnmXML_Attr_Name).isNull()
|| nodeMap.namedItem(kAnmXML_Attr_FrameNum).isNull()
|| nodeMap.namedItem(kAnmXML_Attr_ChildNum).isNull() ) {
return false ;
}
QString name ;
int frameDataNum = 0 ;
int childNum = 0 ;
name = nodeMap.namedItem(kAnmXML_Attr_Name).toAttr().value() ;
frameDataNum = nodeMap.namedItem(kAnmXML_Attr_FrameNum).toAttr().value().toInt() ;
childNum = nodeMap.namedItem(kAnmXML_Attr_ChildNum).toAttr().value().toInt() ;
AnmLayer *pLayer = new AnmLayer ;
pLayer->pParentLayer = pParent ;
pParent->childPtrs.append(pLayer) ;
QDomNode child = node.firstChild() ;
if ( !loadFrameData(child, pLayer, frameDataNum) ) {
return false ;
}
QDomNode layers = node.firstChild() ;
if ( !loadLayers(layers, pLayer) ) {
return false ;
}
}
node = node.nextSibling() ;
}
return true ;
}
示例7: doExecute
void XBELImportCommand::doExecute(const KBookmarkGroup &/*bkGroup*/) {
// check if already open first???
KBookmarkManager *pManager = KBookmarkManager::managerForFile(m_fileName, QString());
QDomDocument doc = GlobalBookmarkManager::self()->mgr()->internalDocument();
// get the xbel
QDomNode subDoc = pManager->internalDocument().namedItem("xbel").cloneNode();
if (subDoc.isProcessingInstruction())
subDoc = subDoc.nextSibling();
if (subDoc.isDocumentType())
subDoc = subDoc.nextSibling();
if (subDoc.nodeName() != "xbel")
return;
if (!folder().isEmpty()) {
// transform into folder
subDoc.toElement().setTagName("folder");
// clear attributes
QStringList tags;
for (int i = 0; i < subDoc.attributes().count(); i++)
tags << subDoc.attributes().item(i).toAttr().name();
for (QStringList::const_iterator it = tags.constBegin(); it != tags.constEnd(); ++it)
subDoc.attributes().removeNamedItem((*it));
subDoc.toElement().setAttribute("icon", m_icon);
// give the folder a name
QDomElement textElem = doc.createElement("title");
subDoc.insertBefore(textElem, subDoc.firstChild());
textElem.appendChild(doc.createTextNode(folder()));
}
// import and add it
QDomNode node = doc.importNode(subDoc, true);
if (!folder().isEmpty()) {
GlobalBookmarkManager::self()->root().internalElement().appendChild(node);
m_group = KBookmarkGroup(node.toElement()).address();
} else {
QDomElement root = GlobalBookmarkManager::self()->root().internalElement();
QList<QDomElement> childList;
QDomNode n = subDoc.firstChild().toElement();
while (!n.isNull()) {
QDomElement e = n.toElement();
if (!e.isNull())
childList.append(e);
n = n.nextSibling();
}
QList<QDomElement>::Iterator it = childList.begin();
QList<QDomElement>::Iterator end = childList.end();
for (; it!= end ; ++it)
root.appendChild((*it));
}
}
示例8: 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);
}
}
}
示例9:
/**
* \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();
}
}
示例10: reportBand
ReportBands OOoReportBuilder::reportBand(QDomNode row)
{
if (row.nodeName() != "table:table-row")
return None;
QString text = cellText(row.firstChild().toElement());
QRegExp rx("\\{\\w+\\}");
int pos = rx.indexIn(text);
if (pos != -1) {
text = text.mid(pos + 1,rx.matchedLength() - 2);
if (!QString::compare(text,"rep_header",Qt::CaseInsensitive))
return ReportHeader;
else if (!QString::compare(text,"rep_footer",Qt::CaseInsensitive))
return ReportFooter;
else {
text = text.remove(QRegExp("\\d+"));
if (!QString::compare(text,"header",Qt::CaseInsensitive))
return DetailHeader;
else if (!QString::compare(text,"footer",Qt::CaseInsensitive))
return DetailFooter;
else if (!QString::compare(text,"detail",Qt::CaseInsensitive))
return Detail;
}
}
return None;
}
示例11: parseUploadPhotoDone
void ImageshackTalker::parseUploadPhotoDone(QByteArray data)
{
int errCode = -1;
QString errMsg = "";
QDomDocument doc("addPhoto");
if (!doc.setContent(data))
return;
QDomElement elem = doc.documentElement();
kDebug() << "-------------" << elem.tagName() << "------------";
kDebug() << data;
if (elem.tagName() == "imginfo")
{
errCode = 0;
}
else
{
kDebug() << elem.tagName();
QDomNode node = elem.firstChild();
if (node.nodeName() == "error") {
errCode = parseErrorResponse(elem, errMsg);
}
}
emit signalBusy(false);
emit signalAddPhotoDone(errCode, errMsg);
}
示例12: parseRow
QDomElement OOoReportBuilder::parseRow(QDomNode row)
{
QDomElement lastElement = row.toElement();
if (reportBand(row) == Detail) {
lastElement = processDetail(row.toElement());
} else {
QDomNode child = row.firstChild();
while (!child.isNull()) {
if (child.nodeName() == "table:table-cell") {
QString str = processString(cellText(child.toElement()));
bool ok;
double value = str.toDouble(&ok);
if (ok) {
setText(child.toElement(), value);
} else
setText(child.toElement(), str);
}
child = child.nextSibling();
}
}
return lastElement;
}
示例13: readVariables
void InternetServerPlatform::readVariables( QDomNode node )
{
Logging::logInfo( this, "readVariables()" );
if( node.isNull() )
return;
QDomNode variable = node.firstChild();
while( false == variable.isNull() )
{
if( QDomNode::CommentNode != variable.nodeType() )
{
QString variableName = variable.nodeName();
if( _variableList.contains(variableName) )
continue;
QString variableValue = variable.attributes().namedItem("value").nodeValue();
replaceVariables( variableValue );
_variableList.insert( variableName, variableValue );
Logging::logInfo( this, QString("%1 = %2").arg(variableName).arg(variableValue) );
variable = variable.nextSibling();
}
}
}
示例14: findChild
QDomNode findChild( QDomNode &parent, const QString &name )
{
for ( QDomNode n = parent.firstChild(); !n.isNull(); n = n.nextSibling() )
if ( n.nodeName() == name )
return n;
return QDomNode();
}
示例15: parseXMLToQTreeWidget
QTreeWidget* ReadAndWriteXML::parseXMLToQTreeWidget(const QDomDocument *doc, QTreeWidget * treeWidget) {
//VERIFYING IS A NODE
if (doc==NULL) {
QMessageBox::warning(0, "parseXMLToQTreeWidget","NULL POINTER");
Q_ASSERT(FALSE);
}
if (doc->isNull()){
QMessageBox::warning(0, "parseXMLToQTreeWidget","QDomDocument is null");
Q_ASSERT(FALSE);
}
if (!doc->isDocument()) {
QMessageBox::warning(0, "parseXMLToQTreeWidget",QObject::tr("QDomDocument is not a document is %1 ").arg(doc->nodeType()));
Q_ASSERT(FALSE);
}
if (treeWidget==NULL) treeWidget=new QTreeWidget();
else treeWidget->clear();
qDebug() << "DomParser::parseXMLToQTreeWidget start parsing " << doc->nodeName() ;
QDomNode node = doc->firstChild();
qDebug() << "DomParser::parseXMLToQTreeWidget first child is " << node.nodeName() ;
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget,QStringList(QString("Type: %1").arg(node.nodeName())));
treeWidget->addTopLevelItem(item);
treeWidget->setColumnCount(1);
while (!node.isNull()) {
parseEntry(node.toElement(), item);
node = node.nextSibling();
}
return treeWidget;
}