本文整理汇总了C++中QDomNode::appendChild方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::appendChild方法的具体用法?C++ QDomNode::appendChild怎么用?C++ QDomNode::appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomNode
的用法示例。
在下文中一共展示了QDomNode::appendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveStreet
void GenericFeature::saveStreet(QDomDocument& doc, QDomNode& node) {
// write length node
QDomElement node_length = doc.createElement("length");
node.appendChild(node_length);
for (QMap<float, float>::iterator it = streetLengths.begin(); it != streetLengths.end(); ++it) {
QDomElement node_length_data = doc.createElement("data");
QString str;
str.setNum(it.key());
node_length_data.setAttribute("key", str);
node_length.appendChild(node_length_data);
str.setNum(it.value());
QDomText node_length_value = doc.createTextNode(str);
node_length_data.appendChild(node_length_value);
}
// write numDirections node
QDomElement node_numDirections = doc.createElement("numDirections");
node.appendChild(node_numDirections);
for (QMap<int, float>::iterator it = streetNumDirections.begin(); it != streetNumDirections.end(); ++it) {
QDomElement node_numDirections_data = doc.createElement("data");
QString str;
str.setNum(it.key());
node_numDirections_data.setAttribute("key", str);
node_numDirections.appendChild(node_numDirections_data);
str.setNum(it.value());
QDomText node_numDirections_value = doc.createTextNode(str);
node_numDirections_data.appendChild(node_numDirections_value);
}
}
示例2: writeXml
void QgsMapSettings::writeXml( QDomNode &node, QDomDocument &doc )
{
// units
node.appendChild( QgsXmlUtils::writeMapUnits( mapUnits(), doc ) );
// Write current view extents
node.appendChild( QgsXmlUtils::writeRectangle( extent(), doc ) );
// Write current view rotation
QDomElement rotNode = doc.createElement( QStringLiteral( "rotation" ) );
rotNode.appendChild(
doc.createTextNode( qgsDoubleToString( rotation() ) )
);
node.appendChild( rotNode );
// destination CRS
if ( mDestCRS.isValid() )
{
QDomElement srsNode = doc.createElement( QStringLiteral( "destinationsrs" ) );
node.appendChild( srsNode );
mDestCRS.writeXml( srsNode, doc );
}
//render map tile
QDomElement renderMapTileElem = doc.createElement( QStringLiteral( "rendermaptile" ) );
QDomText renderMapTileText = doc.createTextNode( testFlag( QgsMapSettings::RenderMapTile ) ? "1" : "0" );
renderMapTileElem.appendChild( renderMapTileText );
node.appendChild( renderMapTileElem );
}
示例3: xCreateDom
void
vleVpm::setOutputGUIplugin(const QString& viewName, const QString& pluginName)
{
xCreateDom();
QDomElement docElem = mDocVpm->documentElement();
QDomNode outGUIplugs =
mDocVpm->elementsByTagName("outputGUIplugins").item(0);
if (outGUIplugs.isNull() ) {
QDomNode metaData = mDocVpm->elementsByTagName(
"vle_project_metadata").item(0);
undoStackVpm->snapshot(metaData);
metaData.appendChild(mDocVpm->createElement("outputGUIplugins"));
outGUIplugs = mDocVpm->elementsByTagName("outputGUIplugins").item(0);
} else {
undoStackVpm->snapshot(outGUIplugs);
}
QDomNodeList plugins =
outGUIplugs.toElement().elementsByTagName("outputGUIplugin");
for (int i =0; i< plugins.length(); i++) {
QDomNode plug = plugins.at(i);
for (int j=0; j< plug.attributes().size(); j++) {
if ((plug.attributes().item(j).nodeName() == "view") and
(plug.attributes().item(j).nodeValue() == viewName)) {
plug.toElement().setAttribute("GUIplugin", pluginName);
return;
}
}
}
QDomElement el = mDocVpm->createElement("outputGUIplugin");
el.setAttribute("view", viewName);
el.setAttribute("GUIplugin", pluginName);
outGUIplugs.appendChild(el);
}
示例4: 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 ) );
}
}
}
示例5: get_state
QDomNode AudioTrack::get_state( QDomDocument doc, bool istemplate)
{
QDomElement node = doc.createElement("Track");
Track::get_state(doc, node, istemplate);
node.setAttribute("numtakes", m_numtakes);
node.setAttribute("showclipvolumeautomation", m_showClipVolumeAutomation);
node.setAttribute("InputBus", m_busInName);
if (! istemplate ) {
QDomNode clips = doc.createElement("Clips");
apill_foreach(AudioClip* clip, AudioClip, m_clips) {
if (clip->get_length() == qint64(0)) {
PERROR("Clip length is 0! This shouldn't happen!!!!");
continue;
}
QDomElement clipNode = doc.createElement("Clip");
clipNode.setAttribute("id", clip->get_id() );
clips.appendChild(clipNode);
}
node.appendChild(clips);
}
示例6: addXml
void DataManagerImpl::addXml(QDomNode& parentNode)
{
QDomDocument doc = parentNode.ownerDocument();
QDomElement dataManagerNode = doc.createElement("datamanager");
parentNode.appendChild(dataManagerNode);
m_rMpr_History->addXml(dataManagerNode);
QDomElement landmarkPropsNode = doc.createElement("landmarkprops");
LandmarkPropertyMap::iterator it = mLandmarkProperties.begin();
for (; it != mLandmarkProperties.end(); ++it)
{
QDomElement landmarkPropNode = doc.createElement("landmarkprop");
it->second.addXml(landmarkPropNode);
landmarkPropsNode.appendChild(landmarkPropNode);
}
dataManagerNode.appendChild(landmarkPropsNode);
QDomElement landmarksNode = doc.createElement("landmarks");
mPatientLandmarks->addXml(landmarksNode);
dataManagerNode.appendChild(landmarksNode);
QDomElement centerNode = doc.createElement("center");
centerNode.appendChild(doc.createTextNode(qstring_cast(mCenter)));
dataManagerNode.appendChild(centerNode);
for (DataMap::const_iterator iter = mData.begin(); iter != mData.end(); ++iter)
{
QDomElement dataNode = doc.createElement("data");
dataManagerNode.appendChild(dataNode);
iter->second->addXml(dataNode);
}
}
示例7: writemessages
void loader::writemessages(QDomNode& mess, QDomDocument root){
QVector<message*> messlist=_boss->_messagedb;
QVector<message*>::const_iterator it=messlist.begin();
for(;it!=messlist.end();++it){
QDomNode message=root.createElement(QString("message"));
mess.appendChild(message);
QDomNode sender=root.createElement(QString("sender")),
recever=root.createElement(QString("recever")),
object=root.createElement(QString("object")),
text=root.createElement(QString("text")),
read=root.createElement(QString("read"));
message.appendChild(sender);
message.appendChild(recever);
message.appendChild(object);
message.appendChild(text);
message.appendChild(read);
QString readed;
QDomText usersender=root.createTextNode((*it)->sender()->user()->user()),
userrecever=root.createTextNode((*it)->recever()->user()->user()),
objecttemp=root.createTextNode((*it)->object()),
texttemp=root.createTextNode((*it)->text()),
readtemp=root.createTextNode(readed.setNum((*it)->read()));
sender.appendChild(usersender);
recever.appendChild(userrecever);
object.appendChild(objecttemp);
text.appendChild(texttemp);
read.appendChild(readtemp);
}
}
示例8: QDomNode
QDomNode QDomNodeProto:: appendChild(const QDomNode& newChild)
{
QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
if (item)
return item->appendChild(newChild);
return QDomNode();
}
示例9: generateTitleInfos
void TextDocumentGeneratorPrivate::generateTitleInfos()
{
QStack< QPair<int,QDomNode> > parentNodeStack;
QDomNode parentNode = mDocumentSynopsis;
parentNodeStack.push( qMakePair( 0, parentNode ) );
for ( int i = 0; i < mTitlePositions.count(); ++i ) {
const TitlePosition &position = mTitlePositions[ i ];
Okular::DocumentViewport viewport = TextDocumentUtils::calculateViewport( mDocument, position.block );
QDomElement item = mDocumentSynopsis.createElement( position.title );
item.setAttribute( QStringLiteral("Viewport"), viewport.toString() );
int headingLevel = position.level;
// we need a parent, which has to be at a higher heading level than this heading level
// so we just work through the stack
while ( ! parentNodeStack.isEmpty() ) {
int parentLevel = parentNodeStack.top().first;
if ( parentLevel < headingLevel ) {
// this is OK as a parent
parentNode = parentNodeStack.top().second;
break;
} else {
// we'll need to be further into the stack
parentNodeStack.pop();
}
}
parentNode.appendChild( item );
parentNodeStack.push( qMakePair( headingLevel, QDomNode(item) ) );
}
}
示例10: toSld
void QgsVectorLayerSimpleLabeling::toSld( QDomNode &parent, const QgsStringMap &props ) const
{
if ( mSettings->drawLabels )
{
QDomDocument doc = parent.ownerDocument();
QDomElement ruleElement = doc.createElement( QStringLiteral( "se:Rule" ) );
parent.appendChild( ruleElement );
// scale dependencies
if ( mSettings->scaleVisibility )
{
QgsStringMap scaleProps = QgsStringMap();
// tricky here, the max scale is expressed as its denominator, but it's still the max scale
// in other words, the smallest scale denominator....
scaleProps.insert( "scaleMinDenom", qgsDoubleToString( mSettings->maximumScale ) );
scaleProps.insert( "scaleMaxDenom", qgsDoubleToString( mSettings->minimumScale ) );
QgsSymbolLayerUtils::applyScaleDependency( doc, ruleElement, scaleProps );
}
writeTextSymbolizer( ruleElement, *mSettings, props );
}
}
示例11: writeTextNode
bool KOfficePlugin::writeTextNode(QDomDocument & doc,
QDomNode & parentNode,
const QString &nodeName,
const QString &value) const
{
if (parentNode.toElement().isNull()){
kdDebug(7034) << "Parent node is Null or not an Element, cannot write node "
<< nodeName << endl;
return false;
}
// If the node does not exist, we create it...
if (parentNode.namedItem(nodeName).isNull())
QDomNode ex = parentNode.appendChild(doc.createElement(nodeName));
// Now, we are sure we have a node
QDomElement nodeA = parentNode.namedItem(nodeName).toElement();
// Ooops... existing node were not of the good type...
if (nodeA.isNull()){
kdDebug(7034) << "Wrong type of node " << nodeName << ", should be Element"
<< endl;
return false;
}
QDomText txtNode = doc.createTextNode(value);
// If the node has already Text Child, we replace it.
if (nodeA.firstChild().isNull())
nodeA.appendChild(txtNode);
else
nodeA.replaceChild( txtNode, nodeA.firstChild());
return true;
}
示例12: writeXml
void QgsRelation::writeXml( QDomNode &node, QDomDocument &doc ) const
{
QDomElement elem = doc.createElement( QStringLiteral( "relation" ) );
elem.setAttribute( QStringLiteral( "id" ), d->mRelationId );
elem.setAttribute( QStringLiteral( "name" ), d->mRelationName );
elem.setAttribute( QStringLiteral( "referencingLayer" ), d->mReferencingLayerId );
elem.setAttribute( QStringLiteral( "referencedLayer" ), d->mReferencedLayerId );
if ( d->mRelationStrength == RelationStrength::Composition )
{
elem.setAttribute( QStringLiteral( "strength" ), QStringLiteral( "Composition" ) );
}
else
{
elem.setAttribute( QStringLiteral( "strength" ), QStringLiteral( "Association" ) );
}
for ( const FieldPair &pair : qgis::as_const( d->mFieldPairs ) )
{
QDomElement referenceElem = doc.createElement( QStringLiteral( "fieldRef" ) );
referenceElem.setAttribute( QStringLiteral( "referencingField" ), pair.first );
referenceElem.setAttribute( QStringLiteral( "referencedField" ), pair.second );
elem.appendChild( referenceElem );
}
node.appendChild( elem );
}
示例13: appendElements
void MetamodelGeneratorSupport::appendElements(QDomNode parent, QDomNodeList children)
{
const int count = children.length();
for (int i = 0; i < count; i++) {
parent.appendChild(children.at(0));
}
}
示例14: createDouble
void XMLizer::createDouble( QDomDocument &document, QDomNode &parent, QString name, double val )
{
QDomElement e = document.createElement( name );
QDomText t = document.createTextNode( QString::number( val, 'e', 17 ) );
e.appendChild( t );
parent.appendChild( e );
}
示例15:
void XMLizer::createInt64( QDomDocument &document, QDomNode &parent, QString name, qint64 val )
{
QDomElement e = document.createElement( name );
QDomText t = document.createTextNode( QString::number( val ) );
e.appendChild( t );
parent.appendChild( e );
}