本文整理汇总了C++中QDomText::data方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomText::data方法的具体用法?C++ QDomText::data怎么用?C++ QDomText::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomText
的用法示例。
在下文中一共展示了QDomText::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
operator <<= (SensorDescriptionIDL& sensor, const QDomNode& node)
{
if (!node.isNull()) {
QDomNode n1 = node.firstChild();
while(!n1.isNull() ) {
QDomNode n2 = n1.firstChild();
if (!n2.isNull()) {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
if (n1.nodeName() == "minrange") {
sensor.minRange = t.data().toInt();
}
else if (n1.nodeName() == "maxrange") {
sensor.maxRange = t.data().toInt();
}
else if (n1.nodeName() == "focus") {
sensor.focus = deg2Rad(t.data().toDouble());
}
}
}
n1 = n1.nextSibling();
}
}
}
示例2: setDataSource
void QgsProjectBadLayerHandler::setDataSource( QDomNode &layerNode, const QString &dataSource )
{
QDomNode dataSourceNode = layerNode.namedItem( QStringLiteral( "datasource" ) );
QDomElement dataSourceElement = dataSourceNode.toElement();
QDomText dataSourceText = dataSourceElement.firstChild().toText();
QgsDebugMsg( "datasource changed from " + dataSourceText.data() );
dataSourceText.setData( dataSource );
QgsDebugMsg( "to " + dataSourceText.data() );
}
示例3: parseInstrName
static QString parseInstrName(const QString& name)
{
QString sName;
QDomDocument dom;
int line, column;
QString err;
if (!dom.setContent(name, false, &err, &line, &column)) {
QString col, ln;
col.setNum(column);
ln.setNum(line);
QString error = err + "\n at line " + ln + " column " + col;
qDebug("error: %s\n", qPrintable(error));
qDebug(" data:<%s>\n", qPrintable(name));
return QString();
}
for (QDomNode e = dom.documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
for (QDomNode ee = e.firstChild(); !ee.isNull(); ee = ee.nextSibling()) {
QDomElement el = ee.toElement();
const QString& tag(el.tagName());
if (tag == "symbol") {
QString name = el.attribute(QString("name"));
if (name == "flat")
sName += "b";
else if (name == "sharp")
sName += "#";
}
QDomText t = ee.toText();
if (!t.isNull())
sName += t.data();
}
}
return sName;
}
示例4: _getTitle
/**
Get the project title
XML in file has this form:
\verbatim
<qgis projectname="default project">
<title>a project title</title>
\endverbatim
@todo XXX we should go with the attribute xor title, not both.
*/
static void _getTitle( QDomDocument const &doc, QString & title )
{
QDomNodeList nl = doc.elementsByTagName( "title" );
title = ""; // by default the title will be empty
if ( !nl.count() )
{
QgsDebugMsg( "unable to find title element" );
return;
}
QDomNode titleNode = nl.item( 0 ); // there should only be one, so zeroth element ok
if ( !titleNode.hasChildNodes() ) // if not, then there's no actual text
{
QgsDebugMsg( "unable to find title element" );
return;
}
QDomNode titleTextNode = titleNode.firstChild(); // should only have one child
if ( !titleTextNode.isText() )
{
QgsDebugMsg( "unable to find title element" );
return;
}
QDomText titleText = titleTextNode.toText();
title = titleText.data();
} // _getTitle
示例5: parseBlock
void Format::parseBlock( QTextCursor &cursor, const QDomElement &element )
{
// dbg() << "Format::parseBlock()" << endl;
QDomNode n;
for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
QDomElement e = n.toElement();
if ( e.tagName() == "fragment" ) {
QTextCharFormat format;
if ( e.hasAttribute( "link" ) ) {
format.setAnchor( true );
QString href = e.attribute( "link" );
format.setAnchorHref( href );
format.setFontUnderline( true );
if ( href.startsWith( "todoodle:" ) ) {
format = TextFormats::topicLinkCharFormat( href );
} else {
format = TextFormats::hyperLinkCharFormat( href );
}
}
if ( e.attribute( "bold" ) == "true" ) {
format.setFontWeight( QFont::Bold );
}
if ( e.attribute( "italic" ) == "true" ) {
format.setFontItalic( true );
}
int fontSize = 0;
if ( e.hasAttribute( "fontsize" ) ) {
fontSize = e.attribute( "fontsize" ).toInt();
} else {
fontSize = 10;
}
if ( fontSize > 0 ) format.setFontPointSize( fontSize );
QDomNode n2;
for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
// dbg() << "TICK" << endl;
QDomText t = n2.toText();
if ( !t.isNull() ) {
// dbg() << "TEXT: '" << t.data() << "'" << endl;
cursor.insertText( t.data(), format );
// dbg() << "done" << endl;
} else {
QDomElement e2 = n2.toElement();
if ( !e2.isNull() ) {
if ( e2.tagName() == "todo" ) {
QTextImageFormat f;
if ( e2.attribute( "status" ) == "todo" ) {
f.setName( ":/images/todo.png" );
} else {
f.setName( ":/images/tododone.png" );
}
cursor.insertImage( f );
}
}
}
}
}
}
}
示例6: getText
QString KWDWriter::getText(const QDomElement ¶graph)
{
QDomNode temp = paragraph.elementsByTagName("TEXT").item(0).firstChild();
QDomText currentText = temp.toText();
if (temp.isNull()) {
kWarning(30503) << "no text";
}
return currentText.data();
}
示例7: getFirstText
static QString getFirstText(QDomElement element)
{
for (QDomNode dname = element.firstChild(); !dname.isNull();
dname = dname.nextSibling())
{
QDomText t = dname.toText();
if (!t.isNull())
return t.data();
}
return QString();
}
示例8: tagContent
QString tagContent(const QDomElement &e)
{
// look for some tag content
for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
QDomText i = n.toText();
if(i.isNull())
continue;
return i.data();
}
return "";
}
示例9: load
/**
* Loads the <UML:CheckConstraint> XMI element.
*/
bool UMLCheckConstraint::load( QDomElement & element )
{
QDomNode node = element.firstChild();
QDomText checkConstraintText = node.toText();
if ( checkConstraintText.isNull() )
return false;
m_CheckCondition = checkConstraintText.data();
return true;
}
示例10: if
void
Parameters::operator <<= (const QDomNode& node)
{
Super::operator <<= (node);
if (!node.isNull()) {
QDomNode n1 = node.firstChild();
while(!n1.isNull() ) {
QDomNode n2 = n1.firstChild();
if (!n2.isNull()) {
if (n1.nodeName() == "stdcrystal") {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
stdcrystal = (t.data() == "true");
}
}
else if (n1.nodeName() == "continousmode") {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
continousmode = (t.data() == "true");
}
}
else if (n1.nodeName() == "pollintervall") {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
pollintervall = t.data().toInt();
}
}
else if (n1.nodeName() == "notify") {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
notify = (t.data() == "true");
}
}
else if (n1.nodeName() == "positionstamps") {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
positionStamps = (t.data() == "true");
}
}
else if (n1.nodeName() == "statistics") {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
statistics = (t.data() == "true");
}
}
else if (n1.nodeName() == "laser") {
while (!n2.isNull()) {
if (n2.nodeName() == "scandescription")
laserDescription <<= n2;
n2 = n2.nextSibling();
}
}
}
n1 = n1.nextSibling();
}
}
}
示例11: Exception
void
DifferentialMotionParameters::operator <<= (const QDomNode& _node)
{
Super::operator<<=(_node);
QDomNode n = _node.firstChild();
while( !n.isNull() ) {
QDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() ) { // the node was really an element.
if (e.tagName()=="parameter") {
QDomAttr parameterName = e.attributeNode("name");
QString name;
QString value;
if (!parameterName.isNull()) {
name = parameterName.value();
}
else {
throw Exception("Parameter tag without name.");
}
QDomNode n2 = n.firstChild();
while (!n2.isNull()) {
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really a text element.
value = t.data();
break;
}
n2 = n2.nextSibling();
}
if (n2.isNull())
throw Exception("Parameter " + std::string(name) + "without value.");
if (name == "MinLTranslation")
minLTranslation = value.toInt();
else if (name == "MaxLTranslation")
maxLTranslation = value.toInt();
else if (name == "MinRTranslation")
minRTranslation = value.toInt();
else if (name == "MaxRTranslation")
maxRTranslation = value.toInt();
else if (name == "WheelBase")
wheelBase = value.toInt();
}
}
n = n.nextSibling();
}
}
示例12: while
void
DevParameters::operator <<= (const QDomNode& node)
{
if (!node.isNull()) {
QDomNode n1 = node.firstChild();
while(!n1.isNull() ) {
if (n1.nodeName() == "device") {
QDomNode n2 = n1.firstChild();
QDomText t = n2.toText(); // try to convert the node to a text
if(!t.isNull() ) { // the node was really an element.
device = t.data();
}
}
n1 = n1.nextSibling();
}
}
}
示例13: convertTextNode
bool Converter::convertTextNode(QTextCursor *cursor, const QDomText &element, const QTextCharFormat &format)
{
QString text = element.data();
if (text.startsWith("\n"))
{
text = text.trimmed();
if (!text.isEmpty())
cursor->insertText(text, format);
}
else
{
if (!text.isEmpty())
cursor->insertText(text, format);
}
return true;
}
示例14: value
// Author & Date: Ehsan Azar 15 June 2010
// Purpose: Get current node value
// Inputs:
// val - the default value
QVariant XmlFile::value(const QVariant & val)
{
QVariant res = val;
if (!m_nodes.isEmpty())
{
// Get the current node
QDomElement node = m_nodes.last();
if (!node.isNull())
{
// Array Type is how we distinguish lists
if (node.attribute("Type").compare("Array", Qt::CaseInsensitive) == 0)
{
QVariantList varlist;
QStringList keys = childKeys();
for (int i = 0; i < keys.count(); ++i)
{
QString key = keys[i];
if (i > 0 && key == keys[i - 1])
key = QString(key + "<%1>").arg(i);
// Recursively return the list
beginGroup(key);
QVariant nodevalue = value(QString());
endGroup();
// Make sure value is meaningful
if (nodevalue.isValid())
varlist += nodevalue; // add new value
}
if (!keys.isEmpty())
res = varlist;
} else {
QDomNode child = node.firstChild();
if (!child.isNull())
{
QDomText domText = child.toText();
if (!domText.isNull())
res = domText.data();
else
return toString();
}
}
}
}
return res;
}
示例15: fromXml
void VarList::fromXml(const QDomElement &e)
{
clear();
for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
QDomElement i = n.toElement();
if(i.isNull())
continue;
if(i.tagName() == "item") {
QString var, val;
var = i.attribute("name");
QDomText t = i.firstChild().toText();
if(!t.isNull())
val = t.data();
set(var, val);
}
}
}