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


C++ QValueList::clear方法代码示例

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


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

示例1: candidateActivate

void QUimInputContext::candidateActivate( int nr, int displayLimit )
{
    QValueList<uim_candidate> list;
    list.clear();

#if !UIM_QT_USE_NEW_PAGE_HANDLING
    cwin->activateCandwin( displayLimit );

    /* set candidates */
    uim_candidate cand;
    for ( int i = 0; i < nr; i++ )
    {
        cand = uim_get_candidate( m_uc, i, displayLimit ? i % displayLimit : i );
        list.append( cand );
    }
    cwin->setCandidates( displayLimit, list );

#else /* !UIM_QT_USE_NEW_PAGE_HANDLING */
    nrPages = displayLimit ? ( nr - 1 ) / displayLimit + 1 : 1;
    pageFilled.clear();
    for ( int i = 0; i < nrPages; i++ )
	pageFilled.append( false );

    cwin->setNrCandidates( nr, displayLimit );

    // set page candidates
    prepare_page_candidates( 0 );
    cwin->setPage( 0 );
#endif /* !UIM_QT_USE_NEW_PAGE_HANDLING */
    cwin->popup();
    candwinIsActive = true;
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:32,代码来源:quiminputcontext.cpp

示例2: prepare_page_candidates

void QUimInputContext::prepare_page_candidates( int page )
{
    QValueList<uim_candidate> list;
    list.clear();

    if ( page < 0 )
	return;

    if (pageFilled[ page ] )
	return;

    /* set page candidates */
    uim_candidate cand;
    int pageNr, start, nrCandidates, displayLimit;

    nrCandidates = cwin->nrCandidates;
    displayLimit = cwin->displayLimit;
    start = page * displayLimit;

    if ( displayLimit && ( nrCandidates - start ) > displayLimit )
	pageNr = displayLimit;
    else
	pageNr = nrCandidates - start;

    for ( int i = start; i < ( pageNr + start ); i++ )
    {
        cand = uim_get_candidate( m_uc, i, displayLimit ? i % displayLimit : i );
        list.append( cand );
    }
    pageFilled[ page ] = true;
    cwin->setPageCandidates( page, list );
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:32,代码来源:quiminputcontext.cpp

示例3: relationsValue

void UmlBaseClassInstance::relationsValue(QValueList<SlotRelation> & result) {
    UmlCom::send_cmd(_identifier, relationsCmd, (void *) 0);

    unsigned n = UmlCom::read_unsigned();

    result.clear();
    while (n--) {
        UmlRelation * r = (UmlRelation *) UmlBaseItem::read_();

        result.append(SlotRelation(r, (UmlClassInstance *) UmlBaseItem::read_()));
    }
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:12,代码来源:UmlBaseClassInstance.cpp

示例4: attributesValue

void UmlBaseClassInstance::attributesValue(QValueList<SlotAttribute> & result) {
    UmlCom::send_cmd(_identifier, attributesCmd, (char) 0);

    unsigned n = UmlCom::read_unsigned();

    result.clear();
    while (n--) {
        UmlAttribute * at = (UmlAttribute *) UmlBaseItem::read_();

        result.append(SlotAttribute(at, UmlCom::read_string()));
    }
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:12,代码来源:UmlBaseClassInstance.cpp

示例5: QString

bool Ts2Rtp::addChannels( QPtrList<ChannelDesc> *channels )
{
	int i, j, k, pmtpid=8191;
	ChannelDesc *desc, *d;
	QValueList<int> pids;

	if ( !rtpSocket && !makeSocket() )
		return false;

	sendList = "";
	for ( i=0; i<(int)channels->count(); i++ ) {
		desc = channels->at( i );
		sendList = sendList+desc->name+"|"+QString().setNum(desc->vpid)+"|"+QString().setNum(desc->apid[0].pid)+"|";
		if ( desc->apid[0].ac3 ) sendList+= "y|";
		else sendList+= "n|";
		sendList+= QString().setNum(desc->subpid[0].pid);
		sendList+= "|";
		sendList+= QString().setNum(desc->subpid[0].page);
		sendList+= "|";
		sendList+= QString().setNum(desc->subpid[0].id);
		sendList+= "|";
		sendList+= QString().setNum(desc->subpid[0].type);
		sendList+= "|";
		sendList+= desc->subpid[0].lang+"|";
		for ( j=i; j<(int)channels->count(); j++ ) {
			pids.clear();
			d = channels->at( j );
			if ( d->vpid )
				pids.append( d->vpid );
			for ( k=0; k<d->napid && k<MAX_AUDIO; k++ )
				pids.append( d->apid[k].pid );
			for ( k=0; k<d->nsubpid && k<MAX_DVBSUB; k++ )
				pids.append( d->subpid[k].pid );
			while ( pmtpid==17 || pids.contains( pmtpid ) )
				--pmtpid;
		}
		desc->pmtpid = pmtpid--;
	}
	sendList+="\n";
	psiTables( channels );
	writePsi = true;
	psiTimer.start( 500 );
	return true;
}
开发者ID:iegor,项目名称:kdesktop,代码行数:44,代码来源:ts2rtp.cpp

示例6: setTableArea


//.........这里部分代码省略.........
        {
          if (mergeMatrix[nRow - 1][col].node != 0L) {
            if (m_colSpin->value() < col)
                m_colSpin->setValue(col);
            TableNode tableN = mergeMatrix[nRow - 1][col];
            Node *n = tableN.node;
            setCellText(m_dataTable, nRow - 1, col, i18n("Merged with (%1, %2).").arg(tableN.mergedRow + 1).arg(tableN.mergedCol + 1));
            m_dataTable->item(nRow-1, col)->setEnabled(false);
            tableNode.node = new Node(0L);
            tableNode.node->tag = new Tag(*(n->tag));
            configureCell(nRow-1,  col, tableNode.node);
            newNum++;
            tableNode.merged = true;
            tableNode.mergedRow = tableN.mergedRow;
            tableNode.mergedCol = tableN.mergedCol;
            tableRowTags.append(tableNode);
            if ((uint)nCol >= mergeMatrix[0].size())  // Check if there are enough cols
              for (uint i=0; i<mergeMatrix.size(); i++)
                mergeMatrix[i].resize(2 * mergeMatrix[i].size());
  
          } else
          {
            tableNode.node = new Node(0L);
            newNum++;
            tableNode.node->tag = new Tag();
            tableNode.node->tag->setDtd(m_dtd);
            tableNode.node->tag->parse("<td>", m_write);
            tableNode.merged = false;
            tableRowTags.append(tableNode);
          }
        }
        if (!tableRowTags.isEmpty())
          m_tableTags->append(tableRowTags);
        tableRowTags.clear();
      }
    }
    else if (tagName == "th" || tagName == "td")
    {
      if (countRows)
      {
        int col = nCol;
        while (mergeMatrix[nRow - 1][col].node != 0L) {
          if (m_colSpin->value() < col)
              m_colSpin->setValue(col);
          TableNode tableN = mergeMatrix[nRow - 1][col];
          Node *n = tableN.node;
          setCellText(m_dataTable, nRow - 1, col, i18n("Merged with (%1, %2).").arg(tableN.mergedRow + 1).arg(tableN.mergedCol + 1));
          m_dataTable->item(nRow-1, col)->setEnabled(false);
          tableNode.node = new Node(0L);
          tableNode.node->tag = new Tag(*(n->tag));
          configureCell(nRow-1,  col, tableNode.node);
          newNum++;
          tableNode.merged = true;
          tableNode.mergedRow = tableN.mergedRow;
          tableNode.mergedCol = tableN.mergedCol;
          tableRowTags.append(tableNode);
          col++;
          nCol++;
          if ((uint)nCol >= mergeMatrix[0].size())  // Check if there are enough cols
            for (uint i = 0; i < mergeMatrix.size(); i++)
              mergeMatrix[i].resize(2 * mergeMatrix[i].size());

        }
        nCol++;
        if (m_rowSpin && m_colSpin && m_dataTable)
        {
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:67,代码来源:tableeditor.cpp

示例7: fix

/******************************************************************************
* Must be called after presetting with a KCal::Recurrence, to convert the
* recurrence to KARecurrence types:
* - Convert hourly recurrences to minutely.
* - Remove all but the first day in yearly date recurrences.
* - Check for yearly recurrences falling on February 29th and adjust them as
*   necessary. A 29th of the month rule can be combined with either a 60th day
*   of the year rule or a last day of February rule.
*/
void KARecurrence::fix()
{
    mCachedType = -1;
    mFeb29Type = FEB29_FEB29;
    int convert = 0;
    int days[2] = { 0, 0 };
    RecurrenceRule *rrules[2];
    RecurrenceRule::List rrulelist = rRules();
    RecurrenceRule::List::ConstIterator rr = rrulelist.begin();
    for(int i = 0;  i < 2  &&  rr != rrulelist.end();  ++i, ++rr)
    {
        RecurrenceRule *rrule = *rr;
        rrules[i] = rrule;
        bool stop = true;
        int rtype = recurrenceType(rrule);
        switch(rtype)
        {
            case rHourly:
                // Convert an hourly recurrence to a minutely one
                rrule->setRecurrenceType(RecurrenceRule::rMinutely);
                rrule->setFrequency(rrule->frequency() * 60);
            // fall through to rMinutely
            case rMinutely:
            case rDaily:
            case rWeekly:
            case rMonthlyDay:
            case rMonthlyPos:
            case rYearlyPos:
                if(!convert)
                    ++rr;    // remove all rules except the first
                break;
            case rOther:
                if(dailyType(rrule))
                {
                    // it's a daily rule with BYDAYS
                    if(!convert)
                        ++rr;    // remove all rules except the first
                }
                break;
            case rYearlyDay:
            {
                // Ensure that the yearly day number is 60 (i.e. Feb 29th/Mar 1st)
                if(convert)
                {
                    // This is the second rule.
                    // Ensure that it can be combined with the first one.
                    if(days[0] != 29
                            ||  rrule->frequency() != rrules[0]->frequency()
                            ||  rrule->startDt()   != rrules[0]->startDt())
                        break;
                }
                QValueList<int> ds = rrule->byYearDays();
                if(!ds.isEmpty()  &&  ds.first() == 60)
                {
                    ++convert;    // this rule needs to be converted
                    days[i] = 60;
                    stop = false;
                    break;
                }
                break;     // not day 60, so remove this rule
            }
            case rYearlyMonth:
            {
                QValueList<int> ds = rrule->byMonthDays();
                if(!ds.isEmpty())
                {
                    int day = ds.first();
                    if(convert)
                    {
                        // This is the second rule.
                        // Ensure that it can be combined with the first one.
                        if(day == days[0]  ||  day == -1 && days[0] == 60
                                ||  rrule->frequency() != rrules[0]->frequency()
                                ||  rrule->startDt()   != rrules[0]->startDt())
                            break;
                    }
                    if(ds.count() > 1)
                    {
                        ds.clear();   // remove all but the first day
                        ds.append(day);
                        rrule->setByMonthDays(ds);
                    }
                    if(day == -1)
                    {
                        // Last day of the month - only combine if it's February
                        QValueList<int> months = rrule->byMonths();
                        if(months.count() != 1  ||  months.first() != 2)
                            day = 0;
                    }
                    if(day == 29  ||  day == -1)
                    {
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:101,代码来源:karecurrence.cpp

示例8: layoutItems

int QDockAreaLayout::layoutItems( const QRect &rect, bool testonly )
{
    if ( !dockWindows || !dockWindows->first() )
	return 0;

    dirty = FALSE;

    // some corrections
    QRect r = rect;
    if ( orientation() == Vertical )
	r.setHeight( r.height() - 3 );

    // init
    lines.clear();
    ls.clear();
    QPtrListIterator<QDockWindow> it( *dockWindows );
    QDockWindow *dw = 0;
    int start = start_pos( r, orientation() );
    int pos = start;
    int sectionpos = 0;
    int linestrut = 0;
    QValueList<DockData> lastLine;
    int tbstrut = -1;
    int maxsize = size_extent( rect.size(), orientation() );
    int visibleWindows = 0;

    // go through all widgets in the dock
    while ( ( dw = it.current() ) != 0 ) {
	++it;
	if ( dw->isHidden() )
	    continue;
	++visibleWindows;
	// find position for the widget: This is the maximum of the
	// end of the previous widget and the offset of the widget. If
	// the position + the width of the widget dosn't fit into the
	// dock, try moving it a bit back, if possible.
	int op = pos;
	int dockExtend = dock_extent( dw, orientation(), maxsize );
	if ( !dw->isStretchable() ) {
	    pos = QMAX( pos, dw->offset() );
	    if ( pos + dockExtend > size_extent( r.size(), orientation() ) - 1 )
		pos = QMAX( op, size_extent( r.size(), orientation() ) - 1 - dockExtend );
	}
	if ( !lastLine.isEmpty() && !dw->newLine() && space_left( rect, pos, orientation() ) < dockExtend )
	    shrink_extend( dw, dockExtend, space_left( rect, pos, orientation() ), orientation() );
	// if the current widget doesn't fit into the line anymore and it is not the first widget of the line
	if ( !lastLine.isEmpty() &&
	     ( space_left( rect, pos, orientation() ) < dockExtend || dw->newLine() ) ) {
	    if ( !testonly ) // place the last line, if not in test mode
		place_line( lastLine, orientation(), linestrut, size_extent( r.size(), orientation() ), tbstrut, maxsize, this );
	    // remember the line coordinats of the last line
	    if ( orientation() == Horizontal )
		lines.append( QRect( 0, sectionpos, r.width(), linestrut ) );
	    else
		lines.append( QRect( sectionpos, 0, linestrut, r.height() ) );
	    // do some clearing for the next line
	    lastLine.clear();
	    sectionpos += linestrut;
	    linestrut = 0;
	    pos = start;
	    tbstrut = -1;
	}

	// remeber first widget of a line
	if ( lastLine.isEmpty() ) {
	    ls.append( dw );
	    // try to make the best position
	    int op = pos;
	    if ( !dw->isStretchable() )
		pos = QMAX( pos, dw->offset() );
	    if ( pos + dockExtend > size_extent( r.size(), orientation() ) - 1 )
		pos = QMAX( op, size_extent( r.size(), orientation() ) - 1 - dockExtend );
	}
	// do some calculations and add the remember the rect which the docking widget requires for the placing
	QRect dwRect(pos, sectionpos, dockExtend, dock_strut( dw, orientation()  ) );
	lastLine.append( DockData( dw, dwRect ) );
	if ( ::qt_cast<QToolBar*>(dw) )
	    tbstrut = QMAX( tbstrut, dock_strut( dw, orientation() ) );
	linestrut = QMAX( dock_strut( dw, orientation() ), linestrut );
	add_size( dockExtend, pos, orientation() );
    }

    // if some stuff was not placed/stored yet, do it now
    if ( !testonly )
	place_line( lastLine, orientation(), linestrut, size_extent( r.size(), orientation() ), tbstrut, maxsize, this );
    if ( orientation() == Horizontal )
	lines.append( QRect( 0, sectionpos, r.width(), linestrut ) );
    else
	lines.append( QRect( sectionpos, 0, linestrut, r.height() ) );
    if ( *(--lines.end()) == *(--(--lines.end())) )
	lines.remove( lines.at( lines.count() - 1 ) );

    it.toFirst();
    bool hadResizable = FALSE;
    while ( ( dw = it.current() ) != 0 ) {
	++it;
	if ( !dw->isVisibleTo( parentWidget ) )
	    continue;
	hadResizable = hadResizable || dw->isResizeEnabled();
	dw->updateSplitterVisibility( visibleWindows > 1 ); //!dw->area()->isLastDockWindow( dw ) );
//.........这里部分代码省略.........
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:101,代码来源:qdockarea.cpp


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