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


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

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


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

示例1: QDomNode

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

示例2: removeFromProjectFile

/*
  Remove a file from the project file.
  Don't delete the file.
*/
bool ProjectManager::removeFromProjectFile(QString projectPath, QString filePath)
{
  bool retval = false;
  QDomDocument doc;
  QDir dir(projectPath);
  QFile projectFile(dir.filePath(dir.dirName() + ".xml"));
  if(doc.setContent(&projectFile))
  {
    projectFile.close();
    QDomNodeList files = doc.elementsByTagName("files").at(0).childNodes();
    for(int i = 0; i < files.count(); i++)
    {
      if(files.at(i).toElement().text() == dir.relativeFilePath(filePath))
      {
        QDomNode parent = files.at(i).parentNode();
        parent.removeChild(files.at(i));
        if(projectFile.open(QIODevice::WriteOnly|QFile::Text))
        {
          projectFile.write(doc.toByteArray(2));
          retval = true;
        }
      }
    }
  }
  return retval;
}
开发者ID:YTakami,项目名称:makecontroller,代码行数:30,代码来源:ProjectManager.cpp

示例3: deleteItemPermanently

void BookmarkWidget::deleteItemPermanently(const QString xmlPath, QTreeWidgetItem* item)
{
    if(!item) {
        QList<QTreeWidgetItem*> list = bTreeWidget->selectedItems();
        if(list.isEmpty()) return;
        item = list.at(0);
        if(!item) return;
    }
    // DT: don't move this!
    QString uuid = item->text(UUID_COLUMN);

    QDomDocument doc;
    QDomElement elt = findElementbyUUID(doc, uuid, BOOKMARK, xmlPath);

    QList<QTreeWidgetItem *> items = bTreeWidget->findItems(uuid, Qt::MatchExactly, UUID_COLUMN);
    item = items.at(0);
    delete item;

    if(elt.isNull()) return;

    QDomNode parent = elt.parentNode();
    parent.removeChild(elt);
    saveDOMToFile(doc, xmlPath);
    //refreshBookmarkList();
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:25,代码来源:bookmarkWidget.cpp

示例4: while

void
PolicyDocumentClass::delTransitionsTo(const QString& name)
{
    QDomElement docElem = document_->documentElement();

    // for all actionPatterns ... //
    QDomNode patternNode = docElem.firstChild();
    while(!patternNode.isNull()) {

        // for all children (behaviours, transitions, arbiters) ... //
        QDomNode node = patternNode.firstChild();
        while(!node.isNull()) {

            // if tagName == "transition" -> check target //
            if (node.toElement().tagName() == XML_TAG_TRANSITION) {

                QDomElement element = node.toElement();
                // if target == pattern name -> delete transition //
                if (element.attribute("target") == name) {
                    patternNode.removeChild(node);
                    node = patternNode.firstChild();	// TODO: improve!
                    modified_ = true;
                }
            }

            // TODO: check if this does the right thing when a node is deleted!
            node = node.nextSibling();
        }

        patternNode = patternNode.nextSibling();
    }
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:32,代码来源:PolicyDocument.cpp

示例5: modifykey

bool arnConfig::modifykey(const char *key, const char *newvalue)
{
    QString nodeKey (key);
    QDomNode out;
    
    if (doc->nodeName() == key) {
	doc->setNodeValue (QString(newvalue));
	return true;
    } 

    if (!(out = _findkeyonchildren (*doc, key)).isNull()) {
	out.removeChild (out.firstChild());
	out.appendChild (doc->createTextNode (newvalue));

	return true;
    }

    return false;

/*
    xmlNodePtr rn = xmlDocGetRootElement(doc);
    xmlNodePtr out;
    if ((!xmlStrcmp(rn->name,(const xmlChar*)key))) {
        xmlNodeSetContent(rn,(const xmlChar*)newvalue);
        return true;
        }
    if ((out = _findkeyonchildren(rn,key))) {
        xmlNodeSetContent(out,(const xmlChar*)newvalue);
        return true;
        }
    return false;
*/
}
开发者ID:fanakin,项目名称:arnlib,代码行数:33,代码来源:arnConfig.cpp

示例6: 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

示例7: writeXml

void QgsObjectCustomProperties::writeXml( QDomNode& parentNode, QDomDocument& doc ) const
{
  //remove already existing <customproperties> tags
  QDomNodeList propertyList = parentNode.toElement().elementsByTagName( "customproperties" );
  for ( int i = 0; i < propertyList.size(); ++i )
  {
    parentNode.removeChild( propertyList.at( i ) );
  }

  QDomElement propsElement = doc.createElement( "customproperties" );

  for ( QMap<QString, QVariant>::const_iterator it = mMap.constBegin(); it != mMap.constEnd(); ++it )
  {
    QDomElement propElement = doc.createElement( "property" );
    propElement.setAttribute( "key", it.key() );
    if ( it.value().canConvert<QString>() )
    {
      propElement.setAttribute( "value", it.value().toString() );
    }
    else if ( it.value().canConvert<QStringList>() )
    {
      Q_FOREACH ( const QString& value, it.value().toStringList() )
      {
        QDomElement itemElement = doc.createElement( "value" );
        itemElement.appendChild( doc.createTextNode( value ) );
        propElement.appendChild( itemElement );
      }
    }
    propsElement.appendChild( propElement );
  }
开发者ID:AM7000000,项目名称:QGIS,代码行数:30,代码来源:qgsobjectcustomproperties.cpp

示例8: removeDefaultNode

void QQMlDom::removeDefaultNode(QDomElement nDocument, QString element)
{
    QDomNodeList removeList = nDocument.elementsByTagName(element);
    QDomNode rUrl = removeList.at(0);
    qDebug() << "is there a child node ?"  << rUrl.hasChildNodes() <<"  " << rUrl.childNodes().at(0).nodeName() ;
    rUrl.removeChild(rUrl.childNodes().at(0));
}
开发者ID:JosephMillsAtWork,项目名称:InstallerFrontend,代码行数:7,代码来源:qqmldom.cpp

示例9: deleteSelectedNode

void MainWindow::deleteSelectedNode()
{
    if(modelIsSet && currentIndex.isValid())
    {
        QDomNode parent = currentDocument->elementsByTagName(model->itemFromIndex(treeView->currentIndex().sibling(treeView->currentIndex().row(), 0))->parent()->text()).at(0);
        parent.removeChild(parent.childNodes().item(treeView->currentIndex().row()));        
        updateTree();
    }
}
开发者ID:lomsansnom,项目名称:IHM_OFELI,代码行数:9,代码来源:mainwindow.cpp

示例10: clearNodeContents

void XMLWriter::clearNodeContents(QDomNode& p_node)
{
    while( p_node.hasChildNodes() )
    {
        QDomNode node = p_node.childNodes().at(0);
        p_node.removeChild(node);
        node.clear();
    }
}
开发者ID:capeisti,项目名称:uistelupaivakirja-desktop,代码行数:9,代码来源:xmlwriter.cpp

示例11: removeChildNodes

void Xml::removeChildNodes(QDomNode &node) {
    QDomNode child = node.firstChild();

    while(!child.isNull()) {
        QDomNode temp = child;
        child = child.nextSibling();
        node.removeChild(temp);
    }
}
开发者ID:falbrechtskirchinger,项目名称:yadu,代码行数:9,代码来源:xml.cpp

示例12: writeInfo

bool KOfficePlugin::writeInfo( const KFileMetaInfo& info) const
{
  bool no_errors = true;
  QDomDocument doc = getMetaDocument(info.path());
  QDomElement base = getBaseNode(doc).toElement();
  if (base.isNull())
    return false;
  for (int i = 0; Information[i]; i+=2)
    no_errors = no_errors &&
      writeTextNode(doc, base, Information[i],
		    info[DocumentInfo][Information[i]].value().toString());
  // If we need a meta:keywords container, we create it.
  if (base.namedItem(metakeywords).isNull())
    base.appendChild(doc.createElement(metakeywords));
  QDomNode metaKeyNode = base.namedItem(metakeywords);

  QDomNodeList childs = doc.elementsByTagName(metakeyword);
  for (int i = childs.length(); i >= 0; --i){
	  metaKeyNode.removeChild( childs.item(i) );
  }
  QStringList keywordList = QStringList::split(",", info[DocumentInfo][metakeyword].value().toString().stripWhiteSpace(), false);
  for ( QStringList::Iterator it = keywordList.begin(); it != keywordList.end(); ++it ) {
	QDomElement elem = doc.createElement(metakeyword);
	metaKeyNode.appendChild(elem);
	elem.appendChild(doc.createTextNode((*it).stripWhiteSpace()));
    }

  // Now, we store the user-defined data
  QDomNodeList theElements = base.elementsByTagName(metauserdef);
  for (uint i = 0; i < theElements.length(); i++)
    {
      QDomElement el = theElements.item(i).toElement();
      if (el.isNull()){
	kdDebug(7034) << metauserdef << " is not an Element" << endl;
	no_errors = false;
      }

      QString s = info[UserDefined][el.attribute(metaname)].value().toString();
      if (s != el.text()){
	QDomText txt = doc.createTextNode(s);
	if (!el.firstChild().isNull())
	  el.replaceChild(txt, el.firstChild());
	else
	  el.appendChild(txt);
      }
    }

  if (!no_errors){
    kdDebug(7034) << "Errors were found while building " << metafile
	     	  << " for file " << info.path() << endl;
    // It is safer to avoid to manipulate meta.xml if errors, we abort.
    return false;
  }
  writeMetaData(info.path(), doc);
  return true;
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例13: delBehaviour

// deletes a given behaviour //
void PolicyDocumentClass::delBehaviour(const QString& patternName, 
				       const QString& behaviourName)
{
  // get DOM node of the given pattern and behaviour //
  QDomNode patternNode   = getPatternNode(patternName);
  QDomNode behaviourNode = getBehaviourNode(patternName, behaviourName);
  
  // remove DOM node //
  patternNode.removeChild(behaviourNode);
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:11,代码来源:PolicyDocument.cpp

示例14: envRemoved

void CustomMakeConfigWidget::envRemoved()
{
    QString env = envs_combo->currentText();
    QDomNode node = DomUtil::elementByPath(m_dom, m_configGroup + "/make/environments");
    node.removeChild(node.namedItem(env));
    m_allEnvironments.remove(env);
    envs_combo->clear();
    envs_combo->insertStringList(m_allEnvironments);
    m_currentEnvironment = QString::null;
    envChanged( m_allEnvironments[0] );
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:11,代码来源:custommakeconfigwidget.cpp

示例15: changeNode

void NewstuffModelPrivate::changeNode( QDomNode &node, QDomDocument &domDocument, const QString &key, const QString &value, NodeAction action )
{
    if ( action == Append ) {
        QDomNode newNode = node.appendChild( domDocument.createElement( key ) );
        newNode.appendChild( domDocument.createTextNode( value ) );
    } else {
        QDomNode oldNode = node.namedItem( key );
        if ( !oldNode.isNull() ) {
            oldNode.removeChild( oldNode.firstChild() );
            oldNode.appendChild( domDocument.createTextNode( value ) );
        }
    }
}
开发者ID:,项目名称:,代码行数:13,代码来源:


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