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


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

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


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

示例1:

OutputImageParams::PartialXform::PartialXform(QDomElement const& el)
:	m_11(el.namedItem("m11").toElement().text().toDouble()),
	m_12(el.namedItem("m12").toElement().text().toDouble()),
	m_21(el.namedItem("m21").toElement().text().toDouble()),
	m_22(el.namedItem("m22").toElement().text().toDouble())
{
}
开发者ID:DikBSD,项目名称:STE,代码行数:7,代码来源:OutputImageParams.cpp

示例2: readRectangle

QgsRectangle QgsXmlUtils::readRectangle( const QDomElement& element )
{
  QgsRectangle aoi;

  QDomNode xminNode = element.namedItem( "xmin" );
  QDomNode yminNode = element.namedItem( "ymin" );
  QDomNode xmaxNode = element.namedItem( "xmax" );
  QDomNode ymaxNode = element.namedItem( "ymax" );

  QDomElement exElement = xminNode.toElement();
  double xmin = exElement.text().toDouble();
  aoi.setXMinimum( xmin );

  exElement = yminNode.toElement();
  double ymin = exElement.text().toDouble();
  aoi.setYMinimum( ymin );

  exElement = xmaxNode.toElement();
  double xmax = exElement.text().toDouble();
  aoi.setXMaximum( xmax );

  exElement = ymaxNode.toElement();
  double ymax = exElement.text().toDouble();
  aoi.setYMaximum( ymax );

  return aoi;
}
开发者ID:kukupigs,项目名称:QGIS,代码行数:27,代码来源:qgsxmlutils.cpp

示例3: processInit

void XDNet::processInit(QDomElement& init)
{

  QDomElement engine = init.namedItem("engine").toElement();
  QDomElement author = init.namedItem("author").toElement();
  QDomElement url = init.namedItem("url").toElement();
  QDomElement copyright = init.namedItem("copyright").toElement();

  kdDebug() << engine.text()
  << ": "
  << url.text()
  << " "
  << copyright.text()
  << endl;


  //setup stdout/sterr:

  QString stdout = "stdout -i 1 -c 1";//copy stdout to IDE
  m_socket->writeBlock(stdout, stdout.length()+1);

  QString stderr = "stderr -i 1 -c 1";//copy stderr to IDE
  m_socket->writeBlock(stderr, stderr.length()+1);

  if(m_debugger->settings()->breakOnLoad())
  {
    requestStepInto();
  }
  else
  {
    requestContinue();
  }
}
开发者ID:thiago-silva,项目名称:protoeditor,代码行数:33,代码来源:xdnet.cpp

示例4: kdDebug

KPIM::FolderLister::ContentType GroupDavGlobals::getContentType(const QDomNode &folderNode)
{
    QDomNode n4;
    kdDebug() << "GroupDavGlobals::getContentType(...)" << endl;
    int type = KPIM::FolderLister::Unknown;
    for(n4 = folderNode.firstChild(); !n4.isNull(); n4 = n4.nextSibling())
    {
        QDomElement e = n4.toElement();

        if(e.tagName() == "resourcetype")
        {
            if(!e.namedItem("vevent-collection").isNull())
                type |= KPIM::FolderLister::Event;
            if(!e.namedItem("vtodo-collection").isNull())
                type |= KPIM::FolderLister::Todo;
            if(!e.namedItem("vjournal-collection").isNull())
                type |= KPIM::FolderLister::Journal;
            if(!e.namedItem("vcard-collection").isNull())
                type |= KPIM::FolderLister::Contact;
            if((type == KPIM::FolderLister::Unknown) &&
                    !(e.namedItem("collection").isNull()))
                type |= KPIM::FolderLister::Folder;
        }
    }
    return (KPIM::FolderLister::ContentType)type;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:26,代码来源:groupdavglobals.cpp

示例5: contains

// Author & Date: Ehsan Azar       23 Aug 2011
// Purpose: Check if a node exists
// Inputs:
//   nodeName  - the node tag (it can be in the form of relative/path/to/node)
// Outputs:
//   Returns true if the current node contains the given node
bool XmlFile::contains(const QString & nodeName)
{
    QDomElement parent; // parent element
    QDomElement set;

    QStringList nodepath = nodeName.split("/");
    int level = nodepath.count();

    // If it is the first node
    if (m_nodes.isEmpty())
    {
        set = m_doc.namedItem(nodepath[0]).toElement();
    } else {
        // Get the parent node
        parent = m_nodes.last();
        // Look if the node exists then get it
        set = parent.namedItem(nodepath[0]).toElement();
    }
    if (set.isNull())
        return false; // not found

    // Look for higher levels
    for (int i = 1; i < level; ++i)
    {
        parent = set;
        set = parent.namedItem(nodepath[i]).toElement();
        if (set.isNull())
            return false; // not found
    }
    return true;
}
开发者ID:jsoutherland,项目名称:CereLink,代码行数:37,代码来源:XmlFile.cpp

示例6: SetAttribute

void ProjectFile::SetAttribute(QString parentTag, QString childTag, QString attribute, QString value)
{
	QDomElement parentTagElement = documentElement().namedItem(parentTag).toElement();
	if (parentTagElement.isNull())
	{
		parentTagElement = createElement(parentTag);
		documentElement().appendChild(parentTagElement);
	}

	QDomElement childTagElement = parentTagElement.namedItem(childTag).toElement();
	if (childTagElement.isNull())
	{
		childTagElement = createElement(childTag);
		parentTagElement.appendChild(childTagElement);
	}

	QDomNode attributeNode = childTagElement.namedItem(value);
	if (!attributeNode.isNull())
	{
		childTagElement.removeChild(attributeNode);
	}

	QDomElement attributeElement = createElement(attribute);
	attributeElement.appendChild(createTextNode(value));
	childTagElement.appendChild(attributeElement);

	SaveProject();
}
开发者ID:atdyer,项目名称:adcircSubdomainTool,代码行数:28,代码来源:ProjectFile.cpp

示例7:

SubmitItem::SubmitItem( const QDomElement& element )
{
    m_artist = element.namedItem( "artist" ).toElement().text();
    m_album = element.namedItem( "album" ).toElement().text();
    m_title = element.namedItem( "title" ).toElement().text();
    m_length = element.namedItem( "length" ).toElement().text().toInt();
    m_playStartTime = element.namedItem( "playtime" ).toElement().text().toUInt();
}
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:8,代码来源:scrobbler.cpp

示例8: file

void
EqualizerPresetManager::slotDefault()
{
    int button = KMessageBox::warningYesNo( this, i18n( "All presets will be deleted and defaults will be restored. Are you sure?" ) );

    if ( button != KMessageBox::Yes )
        return;

    // Preserve the 'Manual' preset
    QList<int> manualGains = m_presets[ i18n("Manual") ];

    // Delete all presets
    m_presets.clear();

    // Create predefined presets 'Zero' and 'Manual'
    QList<int> zeroGains;
    zeroGains << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
    m_presets[ i18n("Zero") ] = zeroGains;
    m_presets[ i18n("Manual") ] = manualGains;

    // Load the default presets
    QFile file( KStandardDirs::locate( "data", "amarok/data/equalizer_presets.xml" ) );

    QTextStream stream( &file );
    stream.setCodec( "UTF8" );

    QDomDocument d;

    if( !file.open( QIODevice::ReadOnly ) || !d.setContent( stream.readAll() ) )
        return;

    QDomNode n = d.namedItem( "equalizerpresets" ).namedItem("preset");

    for( ; !n.isNull();  n = n.nextSibling() )
    {
        QDomElement e = n.toElement();
        QString title = e.attribute( "name" );

        QList<int> gains;
        gains << e.namedItem( "b0" ).toElement().text().toInt();
        gains << e.namedItem( "b1" ).toElement().text().toInt();
        gains << e.namedItem( "b2" ).toElement().text().toInt();
        gains << e.namedItem( "b3" ).toElement().text().toInt();
        gains << e.namedItem( "b4" ).toElement().text().toInt();
        gains << e.namedItem( "b5" ).toElement().text().toInt();
        gains << e.namedItem( "b6" ).toElement().text().toInt();
        gains << e.namedItem( "b7" ).toElement().text().toInt();
        gains << e.namedItem( "b8" ).toElement().text().toInt();
        gains << e.namedItem( "b9" ).toElement().text().toInt();

        m_presets[ title ] = gains;
    }

    file.close();

    // Update listview
    setPresets( m_presets );
}
开发者ID:weiligang512,项目名称:apue-test,代码行数:58,代码来源:equalizerpresetmanager.cpp

示例9:

Params::Params(QDomElement const& el)
:	m_layout(el.namedItem("pages").toElement()),
	m_deps(el.namedItem("dependencies").toElement()),
	m_splitLineMode(
		el.attribute("mode") == "manual"
		? MODE_MANUAL : MODE_AUTO
	)
{
}
开发者ID:4sp1r3,项目名称:scantailor,代码行数:9,代码来源:Params.cpp

示例10: type

PageLayout::PageLayout(QDomElement const& layout_el)
:	m_uncutOutline(
		XmlUnmarshaller::polygonF(
			layout_el.namedItem("outline").toElement()
		)
	),
	m_cutter1(
		XmlUnmarshaller::lineF(
			layout_el.namedItem("cutter1").toElement()
		)
	),
	m_cutter2(
		XmlUnmarshaller::lineF(
			layout_el.namedItem("cutter2").toElement()
		)
	)
{
	QString const type(layout_el.attribute("type"));
	QDomElement const split_line_el(layout_el.namedItem("split-line").toElement());
	if (split_line_el.isNull()) {
		m_type = typeFromString(type);
	} else {
		// Backwards compatibility with versions < 0.9.9
		// Note that we fill in m_uncutOutline elsewhere, namely in Task::process().
		QLineF const split_line(XmlUnmarshaller::lineF(split_line_el));

		// Backwards compatibility with versions <= 0.9.1
		bool const left_page = (
			layout_el.attribute("leftPageValid") == "1"
		);
		bool const right_page = (
			layout_el.attribute("rightPageValid") == "1"
		);

		if (type == "two-pages" || (left_page && right_page)) {
			m_type = TWO_PAGES;
			m_cutter1 = split_line;
			m_cutter2 = QLineF();
		} else if (type == "left-page" || left_page) {
			m_type = SINGLE_PAGE_CUT;
			m_cutter1 = QLineF(0, 0, 0, 1); // A bit of a hack, but should work.
			m_cutter2 = split_line;
		} else if (type == "right-page" || right_page) {
			m_type = SINGLE_PAGE_CUT;
			m_cutter1 = split_line;
			m_cutter2 = QLineF();
			// This one is a special case.  We don't know the outline at this point,
			// so we make m_cutter2 null.  We'll assign the correct value to it in
			// setUncutOutline().
		} else {
			m_type = SINGLE_PAGE_UNCUT;
			m_cutter1 = QLineF();
			m_cutter2 = QLineF();
		}
	}
}
开发者ID:DevangThakkar,项目名称:scantailor,代码行数:56,代码来源:PageLayout.cpp

示例11: filter_el

void
Filter::loadSettings(ProjectReader const& reader, QDomElement const& filters_el)
{
	m_ptrSettings->clear();
	
	QDomElement const filter_el(
		filters_el.namedItem("output").toElement()
	);
	
	QString const page_tag_name("page");
	QDomNode node(filter_el.firstChild());
	for (; !node.isNull(); node = node.nextSibling()) {
		if (!node.isElement()) {
			continue;
		}
		if (node.nodeName() != page_tag_name) {
			continue;
		}
		QDomElement const el(node.toElement());
		
		bool ok = true;
		int const id = el.attribute("id").toInt(&ok);
		if (!ok) {
			continue;
		}
		
		PageId const page_id(reader.pageId(id));
		if (page_id.isNull()) {
			continue;
		}
		
		ZoneSet const picture_zones(el.namedItem("zones").toElement(), m_pictureZonePropFactory);
		if (!picture_zones.empty()) {
			m_ptrSettings->setPictureZones(page_id, picture_zones);
		}

		ZoneSet const fill_zones(el.namedItem("fill-zones").toElement(), m_fillZonePropFactory);
		if (!fill_zones.empty()) {
			m_ptrSettings->setFillZones(page_id, fill_zones);
		}

		QDomElement const params_el(el.namedItem("params").toElement());
		if (!params_el.isNull()) {
			Params const params(params_el);
			m_ptrSettings->setParams(page_id, params);
		}
		
		QDomElement const output_params_el(el.namedItem("output-params").toElement());
		if (!output_params_el.isNull()) {
			OutputParams const output_params(output_params_el);
			m_ptrSettings->setOutputParams(page_id, output_params);
		}
	}
}
开发者ID:Combustible,项目名称:scantailor,代码行数:54,代码来源:Filter.cpp

示例12: restoreFromFile

//---------------------------------------------------------------------------
bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QValueList< KDevPlugin * > plugins )
{
  bool bFileOpenOK = true;

  QFile f(sessionFileName);
  if ( f.open(IO_ReadOnly) ) {  // file opened successfully
    bool ok = domdoc.setContent( &f);
    f.close();
    if (!ok) {
      KMessageBox::sorry(0L,
                         i18n("The file %1 does not contain valid XML.\n"
                         "The loading of the session failed.").arg(sessionFileName));
      initXMLTree(); // because it was now broken after failed setContent()
      return false;
    }
  }
  else {
    bFileOpenOK = false;
  }

  // Check for proper document type.
  if (domdoc.doctype().name() != "KDevPrjSession") {
    KMessageBox::sorry(0L,
    i18n("The file %1 does not contain a valid KDevelop project session ('KDevPrjSession').\n").arg(sessionFileName)
    + i18n("The document type seems to be: '%1'.").arg(domdoc.doctype().name()));
    return false;
  }

  QDomElement session = domdoc.documentElement();

  // read the information about the mainframe widget
  if (bFileOpenOK) {
    recreateDocs(session);
  }

	// now also let the plugins load their session stuff
	QDomElement pluginListEl = session.namedItem("pluginList").toElement();
	QValueList<KDevPlugin*>::ConstIterator it = plugins.begin();
	while( it != plugins.end() )
	{
		KDevPlugin* pPlugin = (*it);
		QString pluginName = pPlugin->instance()->instanceName();
		QDomElement pluginEl = pluginListEl.namedItem(pluginName).toElement();
		if (!pluginEl.isNull()) {
			// now plugin, load what you find!
			pPlugin->restorePartialProjectSession(&pluginEl);
		}
		++it;
	}

	QTimer::singleShot( 0, this, SLOT(loadDocument()) );

  return true;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:55,代码来源:projectsession.cpp

示例13:

Dependencies::Dependencies(QDomElement const& deps_el)
:	m_pageOutline(
		XmlUnmarshaller::polygonF(
			deps_el.namedItem("page-outline").toElement()
		)
	),
	m_rotation(
		XmlUnmarshaller::rotation(
			deps_el.namedItem("rotation").toElement()
		)
	)
{
}
开发者ID:4sp1r3,项目名称:scantailor,代码行数:13,代码来源:Dependencies.cpp

示例14: childNode

QDomNode StyleStack::childNode(const QString & name) const
{
    QList<QDomElement>::ConstIterator it = m_stack.end();
    while ( it != m_stack.begin() )
    {
        --it;
        QDomElement properties = searchAttribute( *it, m_nodeNames, name );
        if ( !properties.namedItem( name ).isNull() )
            return properties.namedItem( name );
    }

    return QDomNode();          // a null node
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:13,代码来源:stylestack.cpp

示例15: readMapLayer

void QgsEditorWidgetRegistry::readMapLayer( QgsMapLayer* mapLayer, const QDomElement& layerElem )
{
  if ( mapLayer->type() != QgsMapLayer::VectorLayer )
  {
    return;
  }

  QgsVectorLayer* vectorLayer = qobject_cast<QgsVectorLayer*>( mapLayer );
  Q_ASSERT( vectorLayer );

  QDomNodeList editTypeNodes = layerElem.namedItem( "edittypes" ).childNodes();

  for ( int i = 0; i < editTypeNodes.size(); i++ )
  {
    QDomNode editTypeNode = editTypeNodes.at( i );
    QDomElement editTypeElement = editTypeNode.toElement();

    QString name = editTypeElement.attribute( "name" );

    int idx = vectorLayer->fieldNameIndex( name );
    if ( idx == -1 )
      continue;

    QString ewv2Type = editTypeElement.attribute( "widgetv2type" );
    QgsEditorWidgetConfig cfg;

    if ( mWidgetFactories.contains( ewv2Type ) )
    {
      vectorLayer->editFormConfig()->setWidgetType( idx, ewv2Type );
      QDomElement ewv2CfgElem = editTypeElement.namedItem( "widgetv2config" ).toElement();

      if ( !ewv2CfgElem.isNull() )
      {
        cfg = mWidgetFactories[ewv2Type]->readEditorConfig( ewv2CfgElem, vectorLayer, idx );
      }

      vectorLayer->editFormConfig()->setReadOnly( idx, ewv2CfgElem.attribute( "fieldEditable", "1" ) != "1" );
      vectorLayer->editFormConfig()->setLabelOnTop( idx, ewv2CfgElem.attribute( "labelOnTop", "0" ) == "1" );
      vectorLayer->editFormConfig()->setNotNull( idx, ewv2CfgElem.attribute( "notNull", "0" ) == "1" );
      vectorLayer->editFormConfig()->setExpression( idx, ewv2CfgElem.attribute( "constraint", QString() ) );
      vectorLayer->editFormConfig()->setExpressionDescription( idx, ewv2CfgElem.attribute( "constraintDescription", QString() ) );

      vectorLayer->editFormConfig()->setWidgetConfig( idx, cfg );
    }
    else
    {
      QgsMessageLog::logMessage( tr( "Unknown attribute editor widget '%1'" ).arg( ewv2Type ) );
    }
  }
}
开发者ID:V17nika,项目名称:QGIS,代码行数:50,代码来源:qgseditorwidgetregistry.cpp


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