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


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

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


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

示例1: modify

void SvgImage::modify(const QString &tag, const QString &id, const QString &attribute,
                      const QString &value)
{
    bool modified = false;

    QDomNodeList nodeList = m_svgDocument.elementsByTagName( tag );
    for ( int i = 0; i < nodeList.count(); ++i )
    {
        QDomNode node = nodeList.at( i );
        QDomNamedNodeMap attributes = node.attributes();
        if ( checkIDAttribute( attributes, id ) )
        {
            QDomNode attrElement = attributes.namedItem( attribute );
            if ( attrElement.isAttr() )
            {
                QDomAttr attr = attrElement.toAttr();
                attr.setValue( value );
                modified = true;
            }
        }
    }

    if ( modified )
    {
        m_updateNeeded = true;
        update();
    }
}
开发者ID:jordonwu,项目名称:qtquick_demo,代码行数:28,代码来源:svgimage.cpp

示例2: isAttr

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

示例3: checkForViewBoxChange

void WbWidget::checkForViewBoxChange(const QDomNode &node) {
	if(node.isAttr() && node.nodeName().toLower() == "viewbox" && node.parentNode() == session_->document().documentElement()) {
		QRectF box = parseSvgViewBox(node.nodeValue());
		if(box.width() > 0 && box.height() > 0) {
			scene_->setSceneRect(box);
		}
	}
}
开发者ID:lyn1337,项目名称:PsiStorm,代码行数:8,代码来源:wbwidget.cpp

示例4: checkIDAttribute

bool checkIDAttribute( const QDomNamedNodeMap& map, const QString& value )
{
    QDomNode attrElement = map.namedItem( "id" );
    if ( attrElement.isAttr() )
    {
        QDomAttr attr = attrElement.toAttr();
        return attr.value() == value;
    }
    return false;
}
开发者ID:jordonwu,项目名称:qtquick_demo,代码行数:10,代码来源:svgimage.cpp

示例5: parseNode

void XMLParser::parseNode(IEntity *entity,QDomNode *node)
{
    while(!node->isNull())
    {
        QString namesp;
        QString name;
        IEntity *auxent = NULL;
        QDomElement child = node->toElement();
        if(!child.isNull())
        {
#ifdef PARSER_DEBUG
            qDebug() << child.tagName();
#endif
            splitNode(child.tagName(),namesp,name);
            if(name.isEmpty())
                throw new XMLParserException("Unable to parse node\n");
            auxent = new IEntity(namesp,name);
        }
        if(node->hasAttributes())
        {
            QDomNamedNodeMap attributes = node->attributes();
            for(unsigned int i=0; i<=attributes.length(); i++)
            {
                QDomNode n = attributes.item(i);
                if(n.isAttr())
                {
#ifdef PARSER_DEBUG
                    qDebug() << n.toAttr().name()<< "=" << n.toAttr().value();
#endif
                    QString attnamesp;
                    QString attname;
                    splitNode(n.toAttr().name(),attnamesp,attname);
                    //TODO: add attribute with namespace
                    auxent->addAttribute(attname,n.toAttr().value());
                }
            }
        }
        if(node->isText())
        {
#ifdef PARSER_DEBUG
            qDebug() << node->toText().data();
#endif
            entity->addValue(node->toText().data());
        } else
            entity->addEntity(auxent);
        if (node->hasChildNodes())
            parseNode(auxent,&node->firstChild());
        node = &(node->nextSibling());
    }
}
开发者ID:ferjm,项目名称:LibQtRest,代码行数:50,代码来源:qtrestxmlparser.cpp

示例6: loadConfigFile

void configManager::loadConfigFile()
{
	// read the XML file and create DOM tree
	QFile cfg_file( m_lmmsRcFile );
	QDomDocument dom_tree;

	if( cfg_file.open( QIODevice::ReadOnly ) )
	{
		QString errorString;
		int errorLine, errorCol;
		if( dom_tree.setContent( &cfg_file, false, &errorString, &errorLine, &errorCol ) )
		{
			// get the head information from the DOM
			QDomElement root = dom_tree.documentElement();

			QDomNode node = root.firstChild();

			// create the settings-map out of the DOM
			while( !node.isNull() )
			{
				if( node.isElement() &&
					node.toElement().hasAttributes () )
				{
					stringPairVector attr;
					QDomNamedNodeMap node_attr =
						node.toElement().attributes();
					for( int i = 0; i < node_attr.count();
									++i )
					{
		QDomNode n = node_attr.item( i );
		if( n.isAttr() )
		{
			attr.push_back( qMakePair( n.toAttr().name(),
							n.toAttr().value() ) );
		}
					}
					m_settings[node.nodeName()] = attr;
				}
				else if( node.nodeName() == "recentfiles" )
				{
					m_recentlyOpenedProjects.clear();
					QDomNode n = node.firstChild();
					while( !n.isNull() )
					{
		if( n.isElement() && n.toElement().hasAttributes() )
		{
			m_recentlyOpenedProjects <<
					n.toElement().attribute( "path" );
		}
		n = n.nextSibling();
					}
				}
				node = node.nextSibling();
			}

			if( value( "paths", "artwork" ) != "" )
			{
				m_artworkDir = value( "paths", "artwork" );
				if( !QDir( m_artworkDir ).exists() )
				{
					m_artworkDir = defaultArtworkDir();
				}
				if( m_artworkDir.right( 1 ) !=
							QDir::separator() )
				{
					m_artworkDir += QDir::separator();
				}
			}
			setWorkingDir( value( "paths", "workingdir" ) );
			setVSTDir( value( "paths", "vstdir" ) );
			setFLDir( value( "paths", "fldir" ) );
			setLADSPADir( value( "paths", "laddir" ) );
		#ifdef LMMS_HAVE_STK
			setSTKDir( value( "paths", "stkdir" ) );
		#endif
		#ifdef LMMS_HAVE_FLUIDSYNTH
			setDefaultSoundfont( value( "paths", "defaultsf2" ) );
		#endif
			setBackgroundArtwork( value( "paths", "backgroundartwork" ) );
		}
		else
		{
			QMessageBox::warning( NULL, MainWindow::tr( "Configuration file" ),
									MainWindow::tr( "Error while parsing configuration file at line %1:%2: %3" ).
													arg( errorLine ).
													arg( errorCol ).
													arg( errorString ) );
		}
		cfg_file.close();
	}


	if( m_vstDir.isEmpty() || m_vstDir == QDir::separator() ||
			!QDir( m_vstDir ).exists() )
	{
#ifdef LMMS_BUILD_WIN32
		m_vstDir = windowsConfigPath( CSIDL_PROGRAM_FILES ) +
											QDir::separator() + "VstPlugins";
#else
		m_vstDir = ensureTrailingSlash( QDir::home().absolutePath() );
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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