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


C++ QDomElement::ownerDocument方法代码示例

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


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

示例1: saveItem

void BtBookmarkLoader::saveItem(QTreeWidgetItem* item, QDomElement& parentElement)
{
	BtBookmarkFolder* folderItem = 0;
	BtBookmarkItem* bookmarkItem = 0;

	if ((folderItem = dynamic_cast<BtBookmarkFolder*>(item))) {
		QDomElement elem = parentElement.ownerDocument().createElement("Folder");
		elem.setAttribute("caption", folderItem->text(0));

		parentElement.appendChild(elem);

		for (int i = 0; i < folderItem->childCount(); i++) {
			saveItem(folderItem->child(i), elem);
		}
	}
	else if ((bookmarkItem = dynamic_cast<BtBookmarkItem*>(item))) {
		QDomElement elem = parentElement.ownerDocument().createElement("Bookmark");

		elem.setAttribute("key", bookmarkItem->englishKey());
		elem.setAttribute("description", bookmarkItem->description());
		elem.setAttribute("modulename", bookmarkItem->m_moduleName);
		elem.setAttribute("moduledescription", bookmarkItem->module() ? bookmarkItem->module()->config(CSwordModuleInfo::Description) : QString::null);

		parentElement.appendChild(elem);
	}
}
开发者ID:bibletime,项目名称:historic-bibletime-svn,代码行数:26,代码来源:btbookmarkloader.cpp

示例2: save

void ViewListTreeWidget::save( QDomElement &element ) const
{
    int cnt = topLevelItemCount();
    if ( cnt == 0 ) {
        return;
    }
    QDomElement cs = element.ownerDocument().createElement( "categories" );
    element.appendChild( cs );
    for ( int i = 0; i < cnt; ++i ) {
        ViewListItem *itm = static_cast<ViewListItem*>( topLevelItem( i ) );
        if ( itm->type() != ViewListItem::ItemType_Category ) {
            continue;
        }
        QDomElement c = cs.ownerDocument().createElement( "category" );
        cs.appendChild( c );
        emit const_cast<ViewListTreeWidget*>( this )->updateViewInfo( itm );
        itm->save( c );
        for ( int j = 0; j < itm->childCount(); ++j ) {
            ViewListItem *vi = static_cast<ViewListItem*>( itm->child( j ) );
            if ( vi->type() != ViewListItem::ItemType_SubView ) {
                continue;
            }
            QDomElement el = c.ownerDocument().createElement( "view" );
            c.appendChild( el );
            emit const_cast<ViewListTreeWidget*>( this )->updateViewInfo( vi );
            vi->save( el );
            QDomElement elm = el.ownerDocument().createElement( "settings" );
            el.appendChild( elm );
            static_cast<ViewBase*>( vi->view() )->saveContext( elm );
        }
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:32,代码来源:kptviewlist.cpp

示例3: saveRecurrence

void Incidence::saveRecurrence(QDomElement &element) const
{
    QDomElement e = element.ownerDocument().createElement("recurrence");
    element.appendChild(e);
    e.setAttribute("cycle", mRecurrence.cycle);
    if(!mRecurrence.type.isEmpty())
        e.setAttribute("type", mRecurrence.type);
    writeString(e, "interval", QString::number(mRecurrence.interval));
    for(QStringList::ConstIterator it = mRecurrence.days.begin(); it != mRecurrence.days.end(); ++it)
    {
        writeString(e, "day", *it);
    }
    if(!mRecurrence.dayNumber.isEmpty())
        writeString(e, "daynumber", mRecurrence.dayNumber);
    if(!mRecurrence.month.isEmpty())
        writeString(e, "month", mRecurrence.month);
    if(!mRecurrence.rangeType.isEmpty())
    {
        QDomElement range = element.ownerDocument().createElement("range");
        e.appendChild(range);
        range.setAttribute("type", mRecurrence.rangeType);
        QDomText t = element.ownerDocument().createTextNode(mRecurrence.range);
        range.appendChild(t);
    }
    for(QValueList<QDate>::ConstIterator it = mRecurrence.exclusions.begin();
            it != mRecurrence.exclusions.end(); ++it)
    {
        writeString(e, "exclusion", dateToString(*it));
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:30,代码来源:incidence.cpp

示例4: save

void Signature::save(const QDomElement &element)
{
    QDomElement e = element;

    QDomElement verification = e.ownerDocument().createElement("signature");
    verification.setAttribute("status", d->status);
    verification.setAttribute("sigStatus", d->sigSummary);
    verification.setAttribute("error", d->error);
    verification.setAttribute("fingerprint", d->fingerprint);
    verification.setAttribute("type", d->type);
    QDomText value;
    switch (d->type) {
        case NoType:
        case AsciiDetached:
            value = e.ownerDocument().createTextNode(d->signature);
            break;
        case BinaryDetached:
            value = e.ownerDocument().createTextNode(d->signature.toBase64());
            break;
    }
    verification.appendChild(value);


    e.appendChild(verification);
}
开发者ID:KDE,项目名称:kget,代码行数:25,代码来源:signature.cpp

示例5: on_descriptionPlainTextEdit_textChanged

void MainWindow::on_descriptionPlainTextEdit_textChanged()
{
    if(loadingTheInformations)
        return;
    QList<QListWidgetItem *> itemsUI=ui->itemList->selectedItems();
    if(itemsUI.size()!=1)
        return;
    quint32 selectedItem=itemsUI.first()->data(99).toUInt();
    QDomElement description = items[selectedItem].firstChildElement("description");
    while(!description.isNull())
    {
        if((!description.hasAttribute("lang") && ui->descriptionEditLanguageList->currentText()=="en")
                ||
                (description.hasAttribute("lang") && ui->descriptionEditLanguageList->currentText()==description.attribute("lang"))
                )
        {
            QDomText newTextElement=description.ownerDocument().createTextNode(ui->descriptionPlainTextEdit->toPlainText());
            QDomNodeList nodeList=description.childNodes();
            int sub_index=0;
            while(sub_index<nodeList.size())
            {
                description.removeChild(nodeList.at(sub_index));
                sub_index++;
            }
            description.appendChild(newTextElement);
            return;
        }
        description = description.nextSiblingElement("description");
    }
    QMessageBox::warning(this,tr("Warning"),tr("Text not found"));
}
开发者ID:chiefexb,项目名称:CatchChallenger,代码行数:31,代码来源:MainWindow.cpp

示例6: toXml

void PictureContent::toXml(QDomElement & pe) const
{
    AbstractContent::toXml(pe);
    pe.setTagName("picture");

    // save picture properties
    QDomDocument doc = pe.ownerDocument();
    QDomElement domElement;
    QDomText text;

    // save image url (wether is a local path or remote url)
    domElement = doc.createElement("path");
    pe.appendChild(domElement);
    text = doc.createTextNode(m_fileUrl);
    domElement.appendChild(text);

    // save the effects
    domElement = doc.createElement("effects");
    pe.appendChild(domElement);
    QList<PictureEffect> effectsList = m_afterLoadEffects;
    if (m_photo)
        effectsList.append(m_photo->effects());
    foreach (const PictureEffect & effect, effectsList) {
        QDomElement effectElement = doc.createElement("effect");
        effectElement.setAttribute("type", effect.effect);
        effectElement.setAttribute("param", effect.param);
        if(effect.effect == PictureEffect::Crop) {
            QString cropingRectStr;
            cropingRectStr = QString::number(effect.cropingRect.x()) + " " + QString::number(effect.cropingRect.y())
                + " " + QString::number(effect.cropingRect.width()) + " " + QString::number(effect.cropingRect.height());

            effectElement.setAttribute("cropingRect", cropingRectStr );
        }
        domElement.appendChild(effectElement);
    }
开发者ID:madjar,项目名称:fotowall,代码行数:35,代码来源:PictureContent.cpp

示例7: renameMergedStates

void Archive::renameMergedStates(QDomNode notes, QMap<QString, QString> &mergedStates)
{
	QDomNode n = notes.firstChild();
	while ( ! n.isNull() ) {
		QDomElement element = n.toElement();
		if (!element.isNull()) {
			if (element.tagName() == "group" ) {
				renameMergedStates(n, mergedStates);
			} else if (element.tagName() == "note") {
				QString tags = XMLWork::getElementText(element, "tags");
				if (!tags.isEmpty()) {
					QStringList tagNames = tags.split(";");
					for (QStringList::Iterator it = tagNames.begin(); it != tagNames.end(); ++it) {
						QString &tag = *it;
						if (mergedStates.contains(tag)) {
							tag = mergedStates[tag];
						}
					}
					QString newTags = tagNames.join(";");
					QDomElement tagsElement = XMLWork::getElement(element, "tags");
					element.removeChild(tagsElement);
					QDomDocument document = element.ownerDocument();
					XMLWork::addElement(document, element, "tags", newTags);
				}
			}
		}
		n = n.nextSibling();
	}
}
开发者ID:smarter,项目名称:basket,代码行数:29,代码来源:archive.cpp

示例8: importBasketIcon

void Archive::importBasketIcon(QDomElement properties, const QString &extractionFolder)
{
	QString iconName = XMLWork::getElementText(properties, "icon");
	if (!iconName.isEmpty() && iconName != "basket") {
		QPixmap icon = KIconLoader::global()->loadIcon(
            iconName, KIconLoader::NoGroup, 16, KIconLoader::DefaultState,
            QStringList(), 0L, /*canReturnNull=*/true
            );
		// The icon does not exists on that computer, import it:
		if (icon.isNull()) {
			QDir dir;
			dir.mkdir(Global::savesFolder() + "basket-icons/");
			FormatImporter copier; // Only used to copy files synchronously
			// Of the icon path was eg. "/home/seb/icon.png", it was exported as "basket-icons/_home_seb_icon.png".
			// So we need to copy that image to "~/.kde/share/apps/basket/basket-icons/icon.png":
			int slashIndex = iconName.lastIndexOf('/');
			QString iconFileName = (slashIndex < 0 ? iconName : iconName.right(slashIndex - 2));
			QString source       = extractionFolder + "basket-icons/" + iconName.replace('/', '_');
			QString destination = Global::savesFolder() + "basket-icons/" + iconFileName;
			if (!dir.exists(destination))
				copier.copyFolder(source, destination);
			// Replace the emblem path in the tags.xml copy:
			QDomElement iconElement = XMLWork::getElement(properties, "icon");
			properties.removeChild(iconElement);
			QDomDocument document = properties.ownerDocument();
			XMLWork::addElement(document, properties, "icon", destination);
		}
	}
}
开发者ID:smarter,项目名称:basket,代码行数:29,代码来源:archive.cpp

示例9: saveTo

void Package::saveTo(QDomElement& e) const {
    e.setAttribute("name", name);
    XMLUtils::addTextTag(e, "title", title);
    if (!this->url.isEmpty())
        XMLUtils::addTextTag(e, "url", this->url);
    if (!description.isEmpty())
        XMLUtils::addTextTag(e, "description", description);
    if (!this->getIcon().isEmpty())
        XMLUtils::addTextTag(e, "icon", this->getIcon());
    if (!this->license.isEmpty())
        XMLUtils::addTextTag(e, "license", this->license);
    for (int i = 0; i < this->categories.count(); i++) {
        XMLUtils::addTextTag(e, "category", this->categories.at(i));
    }

    // <link>
    QList<QString> rels = links.uniqueKeys();
    for (int i = 0; i < rels.size(); i++) {
        QString rel = rels.at(i);
        QList<QString> hrefs = links.values(rel);
        for (int j = hrefs.size() - 1; j >= 0; j--) {
            QDomElement e = e.ownerDocument().createElement("link");
            e.setAttribute("rel", rel);
            e.setAttribute("href", hrefs.at(j));
            e.appendChild(e);
        }
    }
}
开发者ID:benpope82,项目名称:npackd-cpp,代码行数:28,代码来源:package.cpp

示例10: outgoingStanza

bool AttentionPlugin::outgoingStanza(int /*account*/, QDomElement& xml) {
    if(enabled) {
        if(xml.tagName() == "iq" && xml.attribute("type") == "result")
        {
            QDomNodeList list = xml.elementsByTagNameNS("http://jabber.org/protocol/disco#info", "query");
            if(!list.isEmpty())
            {
                QDomElement query = list.at(0).toElement();
                if(!query.hasAttribute("node")) {
                    QDomDocument doc = xml.ownerDocument();
                    QDomElement feature = doc.createElement("feature");
                    feature.setAttribute("var", "urn:xmpp:attention:0");
                    query.appendChild(feature);
                }
            }
        }
        else if(xml.tagName() == "presence")
        {
            QDomNodeList list = xml.elementsByTagNameNS("http://jabber.org/protocol/caps", "c");
            if(!list.isEmpty())
            {
                QDomElement c = list.at(0).toElement();
                if(c.hasAttribute("ext")) {
                    QString ext = c.attribute("ext");
                    ext += " at-pl";
                    c.setAttribute("ext", ext);
                }
            }
        }
    }
    return false;
}
开发者ID:psi-plus,项目名称:plugins,代码行数:32,代码来源:attentionplugin.cpp

示例11: saveToXml

void eGuiOpPage::saveToXml(QDomElement &node) const
{
    QDomDocument xml = node.ownerDocument();
    eASSERT(!xml.isNull());

    QDomElement pageEl = xml.createElement("page");
    pageEl.setAttribute("id", m_opPage->getId());
    pageEl.setAttribute("name", QString(m_opPage->getUserName()));
    node.appendChild(pageEl);

    for (eInt i=0; i<items().size(); i++)
    {
        QGraphicsItem *item = items().at(i);
        eASSERT(item != eNULL);

        if (item->type() == QGraphicsTextItem::Type)
        {
            // Save comment item.
            QDomElement cmtEl = xml.createElement("comment");
            cmtEl.setAttribute("xpos", item->pos().x());
            cmtEl.setAttribute("ypos", item->pos().y());
            cmtEl.setAttribute("text", ((QGraphicsTextItem *)item)->toPlainText());
            pageEl.appendChild(cmtEl);
        }
        else
        {
            // Save GUI operator.
            ((eGuiOperator *)item)->saveToXml(pageEl);
        }
    }
}
开发者ID:DX94,项目名称:Enigma-Studio-3,代码行数:31,代码来源:guioppage.cpp

示例12: replaceNode

static void replaceNode(QDomElement &docElem, QDomNode &n, const QStringList &list, const QString &tag)
{
    for(QStringList::ConstIterator it = list.begin();
            it != list.end(); ++it)
    {
        QDomElement e = docElem.ownerDocument().createElement(tag);
        QDomText txt = docElem.ownerDocument().createTextNode(*it);
        e.appendChild(txt);
        docElem.insertAfter(e, n);
    }

    QDomNode next = n.nextSibling();
    docElem.removeChild(n);
    n = next;
//   kDebug(7021) << "Next tag = " << n.toElement().tagName();
}
开发者ID:vasi,项目名称:kdelibs,代码行数:16,代码来源:vfolder_menu.cpp

示例13: xml

 void GwtField::xml(const GwtValue &value, QDomElement &parent) const {
     std::stringstream stream;
     print(value, stream, GwtPrintStyle::XmlFieldValue);
     auto doc = parent.ownerDocument();
     auto text = doc.createTextNode(stream.str().c_str());
     parent.appendChild(text);
 }
开发者ID:makarenya,项目名称:vantagefx,代码行数:7,代码来源:GwtField.cpp

示例14: createRootXmlTags

// createRootXmlTags
//
// This function creates three QStrings, one being an <?xml .. ?> processing
// instruction, and the others being the opening and closing tags of an
// element, <foo> and </foo>.  This basically allows us to get the raw XML
// text needed to open/close an XML stream, without resorting to generating
// the XML ourselves.  This function uses QDom to do the generation, which
// ensures proper encoding and entity output.
static void createRootXmlTags(const QDomElement &root, QString *xmlHeader, QString *tagOpen, QString *tagClose)
{
	QDomElement e = root.cloneNode(false).toElement();

	// insert a dummy element to ensure open and closing tags are generated
	QDomElement dummy = e.ownerDocument().createElement("dummy");
	e.appendChild(dummy);

	// convert to xml->text
	QString str;
	{
		QTextStream ts(&str, QIODevice::WriteOnly);
		e.save(ts, 0);
	}

	// parse the tags out
	int n = str.indexOf('<');
	int n2 = str.indexOf('>', n);
	++n2;
	*tagOpen = str.mid(n, n2-n);
	n2 = str.lastIndexOf('>');
	n = str.lastIndexOf('<');
	++n2;
	*tagClose = str.mid(n, n2-n);

	// generate a nice xml processing header
	*xmlHeader = "<?xml version=\"1.0\"?>";
}
开发者ID:ExtensionHealthcare,项目名称:iris,代码行数:36,代码来源:xmlprotocol.cpp

示例15: makeType

// function that tries to extract a type from an 'attribute' element
// either the elements defines the type itself, or it is defined elsewhere
// in that case, the attribute 'ref' points to the node containing the
// definition
QDomElement
findAttElement(QDomElement e) {
    QDomNode d = e.ownerDocument().documentElement();
    QString ref = e.attribute("ref");
    QDomElement t;
    if (ref.isNull()) {
        // the element has no ref attribute: we scan it's children
        t = e;
        QString type = makeType(e.firstChild().toElement());
        if (type.isNull()) {
            err << "did not find a type" << endl;
        }
        t.setAttribute("type", type);
    } else {
        findTypeElement(ref, d, t);
        if (t.isNull()) {
            if (notfoundattribs.find("name") ==
                    notfoundattribs.end()) {
                err << "Hmm, no element with name '" << ref
                    << "' was found." << endl;
                notfoundattribs.insert("name");
            }
            t = e;
            t.setAttribute("name", ref);
        }
    }
    return t;
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:32,代码来源:parseschema.cpp


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