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


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

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


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

示例1:

/**
 * \en
 * clears all tags from pattern
 * \_en
 * \ru
 * Удаляет все теги из документа, а также строки, в которых содержится тег секции
 * \_ru
 */
void
aMSOTemplate::cleanUpTags()
{
	QDomNode n = docTpl.lastChild();
	while( !n.isNull() ) 
	{
		clearTags(n,false);
		//clearRow(n);
		n = n.previousSibling();
	}
	n = docTpl.lastChild();
	while( !n.isNull() ) 
	{
		//clearTags(n,false);
		clearRow(n);
		n = n.previousSibling();
	}
	n = docTpl.lastChild();
	while (!n.isNull())
	{
		clearAttributes(n, "Table", "ss:ExpandedRowCount");
		n = n.previousSibling();
	}
	
}
开发者ID:app,项目名称:ananas-labs,代码行数:33,代码来源:amsotemplate.cpp

示例2: getNodeTags

/** 
 * \en
 * Added value to end tag with name `sname'. Don't deletes tag. 
 * \_en
 * \ru
 * Рекурсивная функция поиска и замены тегов на их значения в node.
 * Не заменяет теги, а дописывает значения в конец. 
 * Для удаления тэгов используйте функцию cleanUpTags()
 * \_ru
 * \param node - \en context for searching \_en \ru узел, с которого осуществляется поиск. \_ru
 * \param sname - \en tag name \_en \ru имя тега для поиска \_ru
 * \see cleanUpTags() getNodeTags() insertRowValues()
 */
void
aMSOTemplate::searchTags(QDomNode node, const QString &sname )
{
	QDomNode n = node.lastChild();
	while( !n.isNull() )
	{	
		bool res = getNodeTags(n, sname, false);
		if( res ) 
		{
			insertRowValues(n);
		}
		else
		{
			res = getNodeTags(n, sname, true);
			if(res)
			{
				insertTagsValues(n, sname);
			}
			else
			{
				searchTags(n, sname);
			}
		}
		n = n.previousSibling();
	}
}
开发者ID:app,项目名称:ananas-labs,代码行数:39,代码来源:amsotemplate.cpp

示例3: QDomNode

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

示例4: getPrevBehaviourNode

// returns the DOM node of the previous behaviour in a pattern //
QDomNode PolicyDocumentClass::getPrevBehaviourNode(const QString& patternName,
        const QString& behaviourName) const
{
    QDomNode behaviourNode = getBehaviourNode(patternName, behaviourName);

    QDomNode previousNode = behaviourNode.previousSibling();

    // get previous node until a behaviour is found //
    while(previousNode.toElement().tagName() != XML_TAG_BEHAVIOUR) {

        previousNode = previousNode.previousSibling();

        if (previousNode.isNull()) return previousNode;
    }

    return previousNode;
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:18,代码来源:PolicyDocument.cpp

示例5: file

void
ScrobblesListWidget::read()
{
    qDebug() << m_path;

    clear();

    // always have a now playing item in the list
    m_trackItem = new ScrobblesListWidgetItem( this );
    TrackWidget* trackWidget = new TrackWidget( m_track, this );
    trackWidget->setObjectName( "nowPlaying" );
    setItemWidget( m_trackItem, trackWidget );
    m_trackItem->setSizeHint( trackWidget->sizeHint() );
    m_trackItem->setHidden( true );
    m_trackItem->setNowPlaying( true );

    connect( trackWidget, SIGNAL(clicked(TrackWidget&)), SLOT(onItemClicked(TrackWidget&)) );

    // always have the refresh button in the list
    m_refreshItem = new ScrobblesListWidgetItem( this );
    RefreshButton* refreshButton = new RefreshButton( this );
    refreshButton->setObjectName( "refresh" );
    setItemWidget( m_refreshItem, refreshButton );
    m_refreshItem->setSizeHint( refreshButton->sizeHint() );

    connect( refreshButton, SIGNAL(clicked()), SLOT(refresh()) );

    onRefreshing( false );

    // always have a view more item in the list
    m_moreItem = new ScrobblesListWidgetItem( this );
    QPushButton* moreButton = new QPushButton( tr( "More Scrobbles at Last.fm" ), this );
    moreButton->setObjectName( "more" );
    setItemWidget( m_moreItem, moreButton );
    m_moreItem->setSizeHint( moreButton->sizeHint() );

    connect( moreButton, SIGNAL(clicked()), SLOT(onMoreClicked()) );

    QFile file( m_path );
    file.open( QFile::Text | QFile::ReadOnly );
    QTextStream stream( &file );
    stream.setCodec( "UTF-8" );

    QDomDocument xml;
    xml.setContent( stream.readAll() );

    QList<Track> tracks;

    for (QDomNode n = xml.documentElement().lastChild(); !n.isNull(); n = n.previousSibling())
        tracks << Track( n.toElement() );

    addTracks( tracks );
    fetchTrackInfo( tracks );

    limit( kScrobbleLimit );
}
开发者ID:Timmmm,项目名称:lastfm-desktop,代码行数:56,代码来源:ScrobblesListWidget.cpp

示例6: setValue

/**
 * \en
 * Execute replace tags to values. 
 * \_en
 * \ru
 * Выполняет подстановку значения параметра в шаблоне.
 * Есть 2 типа тегов 
 *  \arg обычные теги 
 *  \arg секции - могут находиться ТОЛЬКО в строках таблицы. 

 * Для подстановки значений обычных тегов необходимо выполнить setValue() где name = PARAM (сейчас #define PARAM "param") а value - значение для подстановки. Потом выполнить exec() с параметром = имени тега.
 * Для подстановки секций необходимо з
 адать нужные параметры, используя setValue()
 * а потом выполнить exec() с именем секции. 
 * exec может вызываться нужное число раз как для обычных тегов, так и для секций
 * \_ru
 *  \param sname - \en name of parametr.\_en \ru
 *		  имя параметра\_ru  
 */
QString
aMSOTemplate::exec( const QString &sname )
{
	setValue(sname, getValue(PARAM));
	//search tags in content
	QDomNode n = docTpl.lastChild();
	while( !n.isNull() ) 
	{
		searchTags(n, sname);
		n = n.previousSibling();
	}
	return docTpl.toString();
	
}
开发者ID:app,项目名称:ananas-labs,代码行数:33,代码来源:amsotemplate.cpp

示例7: QSyntaxHighlighter

SyntaxHighlighter::SyntaxHighlighter( CodeEditor *parent, QDomNode& node)
	: QSyntaxHighlighter(parent->document()), m_pEditor(parent)
{
	// string list that holds the key words
	QStringList keys;

	// get first child
	QDomNode temp = node.lastChild();

	//////////////////////////////////////////////////////////////////////////
	// get key words
	while(!temp.isNull())
	{
		// get children
		QDomNodeList children = temp.childNodes();

		// get attributes
		QDomNamedNodeMap attributes = temp.toElement().attributes();

		// extract data
		for (int i = 0; i < children.length(); i++)
		{
			QString keyword = attributes.namedItem("StartTag").nodeValue() + 
								children.at(i).toElement().text() +
								attributes.namedItem("EndTag").nodeValue();

			keys.append(keyword);
		}	
			
		// rule 
		HighlightingRule rule;
		rule.format.setForeground(QColor(attributes.namedItem("Color").nodeValue()));
		rule.format.setFontItalic(attributes.namedItem("Italic").nodeValue().toInt());
		rule.format.setFontWeight(attributes.namedItem("Bold").nodeValue().toInt());

		// add to rule set
		foreach (const QString &pattern, keys)
		{			
			rule.pattern = QRegExp(pattern);
			highlightingRules.append(rule);
		}

		// clear keys
		keys.clear();

		// next
		temp = temp.previousSibling();
	}
开发者ID:Beliazz,项目名称:ClearHLSLEditor,代码行数:48,代码来源:SyntaxHighlighter.cpp

示例8: while

void
ItemXML::moveUp()
{
  QDomElement element = node_.toElement();
  MIRO_ASSERT(!element.isNull());
  QDomNode pre = node_.previousSibling();
  while (!pre.isNull()) {
    QDomElement e = pre.toElement();
    if (!e.isNull() &&
	e.tagName() == element.tagName()) {
      break;
    }
    pre = pre.previousSibling();
  }

  if (!pre.isNull()) {
    Super::moveUp();
    node_.parentNode().insertBefore(node_, pre);
    setModified();
  }
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:21,代码来源:ItemXML.cpp

示例9: serializeToSvg

QDomNode WbNewItem::serializeToSvg(QDomDocument *doc) {
	if(!graphicsItem()) {
		return QDomDocumentFragment();
	}

	// Generate the SVG using QSvgGenerator
	QBuffer buffer;

	QSvgGenerator generator;
	generator.setOutputDevice(&buffer);

	QPainter painter;
	QStyleOptionGraphicsItem options;
	painter.begin(&generator);
	graphicsItem()->paint(&painter, &options);
	painter.end();

	// qDebug("Serialized SVG doc:");
	// qDebug(buffer.buffer());

	// Parse the children of the new root <svg/> from the buffer to a document fragment
	// also add an 'id' attribute to each of the children
	doc->setContent(buffer.buffer());
	QDomDocumentFragment fragment = doc->createDocumentFragment();

	for(QDomNode n = doc->documentElement().lastChild(); !n.isNull(); n = n.previousSibling()) {
		// skip <title/>, <desc/>, and <defs/>
		if(n.isElement() &&
			!(n.nodeName() == "title"
				|| n.nodeName() == "desc"
				|| n.nodeName() == "defs")) {
			n.toElement().setAttribute("id", "e" + SxeSession::generateUUID());
			fragment.insertBefore(n, QDomNode());
		}
	}

	return fragment;
}
开发者ID:Masterblaster0815,项目名称:psi,代码行数:38,代码来源:wbnewitem.cpp

示例10: parseXmlFile

void PhonemeEditorWidget::parseXmlFile()
{
    // Clear old text boxes
    QList<TimeLineTextEdit *> oldText= m_text->findChildren<TimeLineTextEdit *>();
    while(!oldText.isEmpty())
        delete oldText.takeFirst();

    // Clear old phoneme comboboxes
    QList<TimeLineComboBox *> oldPhoneme = m_phonemes->findChildren<TimeLineComboBox *>();
    while(!oldPhoneme.isEmpty())
        delete oldPhoneme.takeFirst();

    // Get new items from phoneme xml
    QDomElement timings = m_phonemeXml.firstChildElement("PhonemeTimings");

    // Get length of phoneme timings
    QDomElement last = timings.lastChildElement("word");
    int sentenceLength = 0;
    if(!last.isNull()) sentenceLength = last.attribute("end", "0").toInt();
    last = timings.lastChildElement("phn");
    if( !last.isNull() ) sentenceLength = max(sentenceLength, last.attribute("end", "0").toInt() );

    // Get minimal phoneme width
    QDomNodeList phnlist = timings.elementsByTagName("phn");
    int minPhnWidth = 999999;
    for(unsigned int i=0; i<phnlist.length(); i++)
    {
        QDomElement phn = phnlist.item(i).toElement();
        // Skip silence
        if( phn.attribute("value").compare("x") == 0 ) continue;
        int start = phn.attribute("start", "0").toInt();
        int end = phn.attribute("end", "999999").toInt();
        if( end-start < minPhnWidth ) minPhnWidth = end-start;
    }
    int minWidth =  (int)( 39.5f / minPhnWidth * sentenceLength );

    // Get length of panels and enlarge them if too small
    if( m_text->width()-2 < minWidth)
    {
        m_text->setFixedWidth(minWidth+2);
        m_phonemes->setFixedWidth(minWidth+2);
        m_phonemeScrollArea->setFixedWidth(m_text->x()+minWidth+2);
    }

    // Add wordBoxes in reverse direction, because first nodes have higher priority
    // and should be printed above of the others
    QDomNode wordNode = timings.lastChild();
    while(!wordNode.isNull())
    {
        // Get words
        if( wordNode.nodeName().compare("word") == 0)
        {
            QDomElement word = wordNode.toElement();
            TimeLineTextEdit* wordBox = new TimeLineTextEdit(word, sentenceLength, m_text);
            connect(wordBox, SIGNAL(xmlNodeChanged()), this, SLOT(enableSaveButton()) );
            wordBox->setVisible(true);

            // Get phonemes of a word
            QDomNodeList phonemeList = word.elementsByTagName("phn");
            // also reverse direction
            for(int i = phonemeList.size()-1; i >=0; i--)
            {
                QDomElement phoneme = phonemeList.item(i).toElement();
                // Skip silence
                if( phoneme.attribute("value").compare("x") == 0 ) continue;
                TimeLineComboBox* phonemeBox = new TimeLineComboBox(phoneme, sentenceLength, m_phonemeList, m_phonemes);
                connect(phonemeBox, SIGNAL(xmlNodeChanged()), this, SLOT(enableSaveButton()) );
                connect(phonemeBox, SIGNAL(xmlNodeChanged()), wordBox, SLOT(updateFromXml()));
                phonemeBox->setVisible(true);
            }
        }
        // Get phonemes which don't belong to words
        else if( wordNode.nodeName().compare("phn") == 0 )
        {
            QDomElement phoneme = wordNode.toElement();
            // Skip silence
            if( phoneme.attribute("value").compare("x") != 0 )
            {
                TimeLineComboBox* phonemeBox = new TimeLineComboBox(phoneme, sentenceLength, m_phonemeList, m_phonemes);
                connect(phonemeBox, SIGNAL(xmlNodeChanged()), this, SLOT(enableSaveButton()) );
                phonemeBox->setVisible(true);
            }
        }

        wordNode = wordNode.previousSibling();
    }
}
开发者ID:dreamsxin,项目名称:nawia,代码行数:87,代码来源:PhonemeEditorWidget.cpp

示例11: addschedulexmldata

void schedulexmldata::addschedulexmldata(QString tmpscheduledate, QString tmpid, QString tmptheme, QString tmpoccurtime, QString tmpoccuraddress,
                                         /*QString tmpremindtime, QString tmpremindway, QString tmpremindsequence,*/ QString tmpeventrepeat, QString tmpdetail)
{
    QFile file("/home/user/.scheduledata.xml");
    if(!file.open(QIODevice::ReadOnly))  return;
    QDomDocument doc;
    if(!doc.setContent(&file)){
        file.close();
        return;
    }
    file.close();

    QDomText text;

    QDomElement root = doc.documentElement();
    QDomElement scheduledate = doc.createElement(QString("scheduledate"));
    QDomAttr scheduledateattr = doc.createAttribute(QString("scheduledateattr"));
    scheduledate.setAttributeNode(scheduledateattr);
    QDomElement schedule = doc.createElement(QString("schedule"));

    QDomNode n = root.firstChild();
    if(n.toElement().attribute(QString("scheduledateattr")) == "00000000"){
        root.removeChild(n);
        root.appendChild(scheduledate);
        scheduledateattr.setValue(tmpscheduledate);
        scheduledate.appendChild(schedule);
    }else{
        bool scheduledateisexistence = false;
        while(!n.isNull()){
            if((n.previousSibling().toElement().attribute(QString("scheduledateattr")) <  tmpscheduledate) &&( tmpscheduledate < n.toElement().attribute(QString("scheduledateattr")))){
                root.insertBefore(scheduledate, n);
                scheduledateattr.setValue(tmpscheduledate);
                scheduledate.appendChild(schedule);
                scheduledateisexistence = true;
            }else if(tmpscheduledate == n.toElement().attribute(QString("scheduledateattr"))){
                n.toElement().appendChild(schedule);
                scheduledateisexistence = true;
            }
            n = n.nextSibling();
        }
        if(!scheduledateisexistence){
            root.appendChild(scheduledate);
            scheduledateattr.setValue(tmpscheduledate);
            scheduledate.appendChild(schedule);
        }
    }


    if(tmpid == "-10"){
        QDomNode nn = root.firstChild();
        while(!nn.isNull()){
            if(tmpscheduledate == nn.toElement().attribute(QString("scheduledateattr"))){
                QDomNodeList schedulelist = nn.toElement().elementsByTagName(QString("schedule"));
                tmpid.setNum(schedulelist.count() - 1);
                qDebug() << tmpid;
            }
            nn = nn.nextSibling();
        }
    }

    QDomAttr scheduleid = doc.createAttribute(QString("id"));
    scheduleid.setValue(QString(tmpid));
    schedule.setAttributeNode(scheduleid);
    QDomElement theme = doc.createElement(QString("theme"));
    text = doc.createTextNode(QString(tmptheme));
    theme.appendChild(text);
    schedule.appendChild(theme);
    QDomElement occurtime = doc.createElement(QString("occurtime"));
    text = doc.createTextNode(QString(tmpoccurtime));
    occurtime.appendChild(text);
    schedule.appendChild(occurtime);
    QDomElement occuraddress = doc.createElement(QString("occuraddress"));
    text = doc.createTextNode(QString(tmpoccuraddress));
    occuraddress.appendChild(text);
    schedule.appendChild(occuraddress);
//    QDomElement remindtime = doc.createElement(QString("remindtime"));
//    text = doc.createTextNode(QString(tmpremindtime));
//    remindtime.appendChild(text);
//    schedule.appendChild(remindtime);
//    QDomElement remindway = doc.createElement(QString("remindway"));
//    text = doc.createTextNode(QString(tmpremindway));
//    remindway.appendChild(text);
//    schedule.appendChild(remindway);
//    QDomElement remindsequence = doc.createElement(QString("remindsequence"));
//    text = doc.createTextNode(QString(tmpremindsequence));
//    remindsequence.appendChild(text);
//    schedule.appendChild(remindsequence);
    QDomElement eventrepeat = doc.createElement(QString("eventrepeat"));
    text = doc.createTextNode(QString(tmpeventrepeat));
    eventrepeat.appendChild(text);
    schedule.appendChild(eventrepeat);
    QDomElement detail = doc.createElement(QString("detail"));
    text = doc.createTextNode(QString(tmpdetail));
    detail.appendChild(text);
    schedule.appendChild(detail);

    if( !file.open(QIODevice::WriteOnly | QIODevice::Truncate)) return;
    QTextStream out(&file);
    doc.save(out, 4);
    file.close();
//.........这里部分代码省略.........
开发者ID:autumnViolet,项目名称:love,代码行数:101,代码来源:schedulexmldata.cpp

示例12: loadFromDomElement

bool ChartElemNavaids::loadFromDomElement(QDomElement& dom_element, 
                                          QDomDocument& dom_doc,
                                          QString& err_msg)
{
    MYASSERT(!dom_element.isNull());
    TreeBaseXML::loadFromDomElement(dom_element, dom_doc, err_msg);

    if (m_dom_element.tagName() != CHART_NODE_NAME_NAVAIDS)
    {
        err_msg = QString("Wrong node name (%s), expected (%s)").
                  arg(m_dom_element.tagName()).arg(CHART_NODE_NAME_NAVAIDS);
        return false;
    }

    // loop through all navaids

    QDomNode node = m_dom_element.firstChild();
    for(; !node.isNull(); node = node.nextSibling())
    {
        QDomElement element = node.toElement();
        if (element.isNull()) continue;

        // extract info from node

        QString id = element.attribute(CHART_ATTR_ID);
        QString ctry = element.attribute(CHART_ATTR_CTRY);
        QString name = element.attribute(CHART_ATTR_NAME);
        double lat = element.attribute(CHART_ATTR_LAT).toDouble();
        double lon = element.attribute(CHART_ATTR_LON).toDouble();
        int freq = element.attribute(CHART_ATTR_FREQ).toUInt();
        bool has_dme = element.attribute(CHART_ATTR_DME).toInt();
        int elevation = element.attribute(CHART_ATTR_ELEV).toInt();

        // check info

        if (id.isEmpty())
        {
            err_msg = QString("Navaids: Missing ID at tag named (%1)").arg(element.tagName());
            return false;
        }

        // process element

        if (element.tagName() == CHART_NODE_NAME_NAVAIDS_VOR)
        {
            Vor* vor = 0;

            if (!name.isEmpty() && lat != 0.0 && lon != 0.0 && freq != 0)
                vor = new Vor(id, name, lat, lon, freq, has_dme, 0, 0, ctry);
            else
                vor = (Vor*)m_chart_model->getNavdata()->getElementsWithSignal(
                    id, ctry, Waypoint::VOR);

            if (!vor)
            {
                err_msg = QString("Navaids:VOR: unknown VOR with ID (%1)").arg(id);
                return false;
            }

            if (!addVor(*vor, element, dom_doc, err_msg))
            {
                node = node.previousSibling();
                m_dom_element.removeChild(element);
            }
            
            delete vor;
        }
        else if (element.tagName() == CHART_NODE_NAME_NAVAIDS_NDB)
        {
            Ndb* ndb = 0;

            if (!name.isEmpty() && lat != 0.0 && lon != 0.0 && freq != 0)
                ndb = new Ndb(id, name, lat, lon, freq, 0, 0, ctry);
            else
                ndb = (Ndb*)m_chart_model->getNavdata()->getElementsWithSignal(
                    id, ctry, Waypoint::NDB);

            if (!ndb)
            {
                err_msg = QString("Navaids:NDB: unknown NDB with ID (%1)").arg(id);
                return false;
            }

            if (!addNdb(*ndb, element, dom_doc, err_msg))
            {
                node = node.previousSibling();
                m_dom_element.removeChild(element);
            }
            
            delete ndb;
        }
        else if (element.tagName() == CHART_NODE_NAME_NAVAIDS_AIRPORT)
        {
            Airport* airport = 0;

            if (!name.isEmpty() && lat != 0.0 && lon != 0.0 && 
                element.hasAttribute(CHART_ATTR_ELEV))
                airport = new Airport(id, name, lat, lon, elevation);
            else
                airport = (Airport*)m_chart_model->getNavdata()->getElementsWithSignal(
//.........这里部分代码省略.........
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:101,代码来源:chart.elem.navaids.cpp


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