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


C++ QPtrList::remove方法代码示例

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


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

示例1: main

int main(int argc,char **argv)
{
	QApplication app(argc,argv);
	QPtrList<int> list;
	
	for (int i=0;i<3;i++)
	{
		list.append(new int(i)); // 插入資料
	}

	list.first(); // 先跳到第一個元素
	for (int i=0;i<3;i++,list.next())
	{
		cout << *(list.current()) << endl;
	}

	list.first();
	list.next();
	list.remove();
	list.remove();
	list.remove();
	cout << *(list.current()) << endl;
	// 由這一個例子可以知道,刪掉一個成員後,指標會跑到下一個.但若刪掉後沒有下一個時,指標會跑到前一個

	return 0;
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:26,代码来源:main.cpp

示例2: consumeReadBuf

/*!
	\internal
	Reads and removes from internal read buffer \a nbytes and place then into \a sink.
	Returns true if successfull or false if there were not enought bytes to fullfill
	the request.
*/
bool cAsyncNetIOPrivate::consumeReadBuf( Q_ULONG nbytes, char *sink )
{
    if ( nbytes <= 0 || nbytes > rsize )
		return false;
    rsize -= nbytes;
    for ( ;; ) 
	{
		QByteArray *a = rba.first();
		if ( rindex + nbytes >= a->size() ) 
		{
			// Here we skip the whole byte array and get the next later
			int len = a->size() - rindex;
			if ( sink ) 
			{
				memcpy( sink, a->data()+rindex, len );
				sink += len;
			}
			nbytes -= len;
			rba.remove();
			rindex = 0;
			if ( nbytes == 0 ) 
			{		// nothing more to skip
				break;
			}
		} else {
			// Here we skip only a part of the first byte array
			if ( sink )
				memcpy( sink, a->data()+rindex, nbytes );
			rindex += nbytes;
			break;
		}
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:40,代码来源:asyncnetio.cpp

示例3: printf

void
xQGanttBarViewPort::deleteSelectedItems()
{
#ifdef _DEBUG_
    printf("-> xQGanttBarViewPort::deleteSelectedItems()\n");
#endif

    QPtrList<KGanttItem> list;
    observeList(&list);

    getSelectedItems(_toplevelitem, list);

    for(KGanttItem *subitem = list.first();
            subitem != 0;
            subitem = list.next())
    {
#ifdef _DEBUG_
        printf(" : %s \n", subitem->getText().latin1());
#endif
        connect(subitem, SIGNAL(destroyed(KGanttItem *)),
                this, SLOT(itemDestroyed(KGanttItem *)));
    }

    list.remove(_toplevelitem);

    while(list.count() > 0)
    {
        KGanttItem *item = list.getFirst();
        delete item;
    }

#ifdef _DEBUG_
    printf("<- xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:35,代码来源:xQGanttBarViewPort.cpp

示例4:

// The dtor.
QsciScintillaBase::~QsciScintillaBase()
{
    // Remove it from the pool.
    poolList.remove(this);

    delete sci;
}
开发者ID:wdobbie,项目名称:Nexpo,代码行数:8,代码来源:qsciscintillabase.cpp

示例5: getMATypes

PlotLine * THERM::calculateCustom (QString &p, QPtrList<PlotLine> &d)
{
  // format1: MA_TYPE, MA_PERIOD, THRESHOLD, SMOOTHING_TYPE, SMOOTHING_PERIOD

  if (checkFormat(p, d, 5, 5))
    return 0;

  QStringList mal;
  getMATypes(mal);
  maType = mal.findIndex(formatStringList[0]);
  maPeriod = formatStringList[1].toInt();
  threshold = formatStringList[2].toDouble();
  smoothType = mal.findIndex(formatStringList[3]);
  smoothing = formatStringList[4].toInt();

  QPtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getTHERM(pll);

  int loop;
  for (loop = pll.count() - 1; loop > 0; loop--)
    pll.remove(loop);

  return pll.at(0);
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:25,代码来源:THERM.cpp

示例6: consumeWriteBuf

/*!
  \internal
  Removes from internal read buffer \a nbytes.
  Returns true if successfull or false if there were not enought bytes in buffer to fullfill
  the request.
*/
bool cAsyncNetIOPrivate::consumeWriteBuf( Q_ULONG nbytes )
{
	if ( nbytes > wsize )
	{
		wsize = 0;
		return false;
	}

	if ( nbytes <= 0 || nbytes > wsize )
		return false;
	wsize -= nbytes;
	for ( ; ; )
	{
		QByteArray* a = ewba.first();
		if ( windex + nbytes >= a->size() )
		{
			nbytes -= a->size() - windex;
			ewba.remove();
			windex = 0;
			if ( nbytes == 0 )
				break;
		}
		else
		{
			windex += nbytes;
			break;
		}
	}
	return false;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:36,代码来源:asyncnetio.cpp

示例7: unregisterSocketNotifier

void QEventLoopEx::unregisterSocketNotifier( QSocketNotifier *notifier )
{
    int sockfd = notifier->socket();
    int type = notifier->type();
    if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) {
#if defined(QT_CHECK_RANGE)
        qWarning( "QSocketNotifier: Internal error" );
#endif
        return;
    }
#ifdef _DEBUG_EVENTLOOPEX
    qDebug( "QSocketNotifier::unregisterSocketNotifier %p", notifier );
#endif

    EnterCriticalSection(&d->m_csVec);
    QPtrList<QSockNotEx> *list = d->sn_vec[type].list;
    fd_set *fds  =  &d->sn_vec[type].enabled_fds;
    QSockNotEx *sn;
    if ( ! list ) {
        LeaveCriticalSection(&d->m_csVec);
        QEventLoop::unregisterSocketNotifier(notifier);
        return;
    }
    sn = list->first();
    while ( sn && !(sn->obj == notifier && sn->fd == sockfd) )
        sn = list->next();
    if ( !sn ) {// not found
        LeaveCriticalSection(&d->m_csVec);
        QEventLoop::unregisterSocketNotifier(notifier);
        return;
    }

    FD_CLR( sockfd, fds ); // clear fd bit
    FD_CLR( sockfd, sn->queue );

    EnterCriticalSection(&d->m_csPendingList);
    d->sn_pending_list.removeRef( sn );		// remove from activation list
    bool bNowEmpty = (d->sn_pending_list.count() == 0);
    LeaveCriticalSection(&d->m_csPendingList);
    if(bNowEmpty)
        SetEvent(d->m_evPendingListEmpty);
    list->remove(); // remove notifier found above

    if ( d->sn_highest == sockfd ) {// find highest fd
        d->sn_highest = -1;
        for ( int i=0; i<3; i++ ) {
            if ( d->sn_vec[i].list && ! d->sn_vec[i].list->isEmpty() )
                d->sn_highest = QMAX( d->sn_highest,  // list is fd-sorted
                                      d->sn_vec[i].list->getFirst()->fd );
        }
    }
    LeaveCriticalSection(&d->m_csVec);
#ifdef _DEBUG_EVENTLOOPEX
    qDebug( "QSocketNotifier::signal update socket");
#endif
    closesocket(d->m_sockUpdate);
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例8: slotChain

void KSSLInfoDlg::slotChain(int x)
{
    if(x == 0)
    {
        displayCert(d->_cert);
    }
    else
    {
        QPtrList< KSSLCertificate > cl = d->_cert->chain().getChain();
        cl.setAutoDelete(true);
        for(int i = 0; i < x - 1; i++)
            cl.remove((unsigned int)0);
        KSSLCertificate thisCert = *(cl.at(0));
        cl.remove((unsigned int)0);
        thisCert.chain().setChain(cl);
        displayCert(&thisCert);
    }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例9: qDebug

QUimInputContext::~QUimInputContext()
{
#ifdef ENABLE_DEBUG
    qDebug( "~QUimInputContext()" );
#endif

    contextList.remove( this );

    if ( m_uc )
        uim_release_context( m_uc );

    if ( this == focusedInputContext )
    {
        focusedInputContext = NULL;
        disableFocusedContext = true;
    }

#ifdef Q_WS_X11
    delete mCompose;
#endif
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:21,代码来源:quiminputcontext.cpp

示例10: unregisterSocketNotifier

void QEventLoop::unregisterSocketNotifier( QSocketNotifier *notifier )
{
    int sockfd = notifier->socket();
    int type = notifier->type();
    if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) {
#if defined(QT_CHECK_RANGE)
	qWarning( "QSocketNotifier: Internal error" );
#endif
	return;
    }

    QPtrList<QSockNot> *list = d->sn_vec[type].list;
    fd_set *fds  =  &d->sn_vec[type].enabled_fds;
    QSockNot *sn;
    if ( ! list )
	return;
    sn = list->first();
    while ( sn && !(sn->obj == notifier && sn->fd == sockfd) )
	sn = list->next();
    if ( !sn ) // not found
	return;

    FD_CLR( sockfd, fds );			// clear fd bit
    FD_CLR( sockfd, sn->queue );
    d->sn_pending_list.removeRef( sn );		// remove from activation list
    list->remove();				// remove notifier found above

    if ( d->sn_highest == sockfd ) {		// find highest fd
	d->sn_highest = -1;
	for ( int i=0; i<3; i++ ) {
	    if ( d->sn_vec[i].list && ! d->sn_vec[i].list->isEmpty() )
		d->sn_highest = QMAX( d->sn_highest,  // list is fd-sorted
				      d->sn_vec[i].list->getFirst()->fd );
	}
    }
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:36,代码来源:qeventloop_unix.cpp

示例11: checkBoxClicked

void HiddenFileView::checkBoxClicked(QCheckBox* chkBox,KToggleAction* action,QLineEdit* edit, int column,QPtrList<QRegExp> & reqExpList,bool b) {
  // We don't save the old state so
  // disable the tristate mode
  chkBox->setTristate(false);
  action->setChecked(b);
  chkBox->setChecked(b);

  HiddenListViewItem* item;
  for (item = static_cast<HiddenListViewItem*>(_dlg->hiddenListView->firstChild());item;
       item = static_cast<HiddenListViewItem*>(item->nextSibling()))
  {
    if (!item->isSelected())
        continue;
        
    if (b == item->isOn(column))
        continue;
            
    if (!b) {
        QRegExp* rx = getRegExpListMatch(item->text(0),reqExpList);
        
        // Perhaps the file was hidden because it started with a dot
        if (!rx && item->text(0)[0]=='.' && _dlg->hideDotFilesChk->isChecked()) {
            int result = KMessageBox::questionYesNo(_dlg,i18n(
                    "<qt>Some files you have selected are hidden because they start with a dot; "
                    "do you want to uncheck all files starting with a dot?</qt>"),i18n("Files Starting With Dot"),i18n("Uncheck Hidden"), i18n("Keep Hidden"));
                
            if (result == KMessageBox::No) {
                QPtrList<HiddenListViewItem> lst = getMatchingItems(QRegExp(".*",false,true));
                deselect(lst);
            } else {
                _dlg->hideDotFilesChk->setChecked(false);
            }
            continue;
        } else {
            if (rx) {
                // perhaps it is matched by a wildcard string
                QString p = rx->pattern();
                if ( p.find("*") > -1 ||
                        p.find("?") > -1 )
                {
                    // TODO after message freeze: why show three times the wildcard string? Once should be enough.
		    // TODO remove <b></b> and use <qt> instead
                    int result = KMessageBox::questionYesNo(_dlg,i18n(
                    "<b></b>Some files you have selected are matched by the wildcarded string <b>'%1'</b>; "
                    "do you want to uncheck all files matching <b>'%1'</b>?").arg(rx->pattern()).arg(rx->pattern()).arg(rx->pattern()),
                    i18n("Wildcarded String"),i18n("Uncheck Matches"),i18n("Keep Selected"));
            
                    QPtrList<HiddenListViewItem> lst = getMatchingItems( *rx );
            
                    if (result == KMessageBox::No) {
                        deselect(lst);
                    } else {
                        setState(lst,column,false);
                        reqExpList.remove(rx);
                        updateEdit(edit, reqExpList);
                    }
                    continue;
                } else {
                    reqExpList.remove(rx);
                    updateEdit(edit, reqExpList);
                }
            }   
        }
    }
    else {
        reqExpList.append( new QRegExp(item->text(0)) );
        updateEdit(edit, reqExpList);
    }
    
    item->setOn(column,b);
  }

  _dlg->hiddenListView->update();
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:74,代码来源:hiddenfileview.cpp

示例12: doExport


//.........这里部分代码省略.........
	out_ << "%                                         %" << endl;
	out_ << "% PMX output generated by \"NoteEdit\"    %" << endl;
	out_ << "%                                         %" << endl;
	out_ << "%-----------------------------------------%" << endl;
	if (pmxOpts_.mLyr) {
		out_ << "---" << endl;
		out_ << "\\input musixtex" << endl;
		out_ << "\\input pmx" << endl;
		out_ << "\\input musixlyr" << endl << endl;
		lyrNames.setAutoDelete(true);
		for (i = 0, staff_elem = staffList_->first(); staff_elem; staff_elem = staffList_->next(), i++) {
			if (!NResource::staffSelExport_[i]) continue;
			voice_elem = staff_elem->getVoiceNr(0);
			if (!(count_of_lyrics = voice_elem->countOfLyricsLines())) continue;
			voice_elem->collectLyrics(lyricslist);
			lyrNames.clear();
			for (j = 0; j < NUM_LYRICS; j++) {
				if (!lyricslist[j].isEmpty()) {
					lyrName = new QString();
					if (count_of_lyrics < 2) {
						lyrName->sprintf("lyrstaff%d", staffsToExport_ - i);
					}
					else {
						lyrName->sprintf("lyrstaff%dverse%d", staffsToExport_ - i, j+1);
					}
					lyrNames.append(lyrName);
					out_ << "\\setlyrics{" << (*lyrName) << "}{" << lyrics2TeX(&(lyricslist[j])) << "}" << endl;
				}
			}
	
			out_ << "\\assignlyrics{" << (staffsToExport_ - i) << "}{";
			while(!lyrNames.isEmpty()) {
				out_ << *(lyrNames.first());
				lyrNames.remove();
				if (!lyrNames.isEmpty()) out_ << ',';
			}
			out_ << '}' << endl << endl;
		}
		out_ << "---" << endl;
	}
/*
	out_ << "---" << endl;
	out_ << "\\def\\mtxInterInstrument#1#2{\\setinterinstrument{#1}{#2\\Interligne}}" << endl;
	out_ << "\\def\\mtxStaffBottom#1{\\staffbotmarg #1\\Interligne}" << endl;
	out_ << "---" << endl << endl;
*/

	out_ << "% nv,noinst,mtrnuml,mtrdenl,mtrnump,mtrdenp,xmtrnum0,isig," << endl;
	out_ << "   " << staffsToExport_ << "    ";
	if (staffsToExport_ == mStaffInf_->getMultiStaffCount()) {
		out_ << staffsToExport_ << "      ";
	}
	else {
		out_ << '-' << mStaffInf_->getMultiStaffCount() << ' ';
		for (i = 0; i < mStaffInf_->getMultiStaffCount(); i++) {
			out_ << mStaffInf_->getStaffCount(mStaffInf_->getMultiStaffCount()-i-1) << ' ';
		}
	}
        out_ << timesig->getNumerator() << "      " <<  timesig->getDenominator() << "        " <<
		timesig->getNumerator() << "      " <<  timesig->getDenominator();
	acr = voice_elem->determineAnacrusis();
	if (acr>0) {
		out_ << "        " << ((double) acr / (128.0 / (double) timesig->getDenominator())) << "      ";
	}
	else {
		out_ << "        0      ";
开发者ID:BackupTheBerlios,项目名称:noteedit-svn,代码行数:67,代码来源:pmxexport.cpp

示例13: slotRemoveColor

void CustomPalette::slotRemoveColor()
{
    int i, j;
    if ( sel_row == -1 || sel_col == -1 )
    {
	//do nothing
    }
    else
    {
        if ( cur_col == 0 )
	{
	    cur_col = numCols() - 1;
	    cur_row--;
	}
	else
	    cur_col--;

        color_matrix[sel_row][sel_col] = invalid_color;
	color_names[sel_row][sel_col] = "";
	alpha_matrix[sel_row][sel_col] = -1;
	updateCell( sel_row, sel_col );

	QPtrList<Color> cl = k_toon -> document() -> getPalette() -> getColors();
	cl.setAutoDelete( true );
	cl.remove( map2Dto1D( sel_row, sel_col ) );
	cl.setAutoDelete( false );
	k_toon -> document() -> getPalette() -> setColors( cl );

	for ( i = sel_row; i < numRows(); i++ )
	{
	    if ( i == sel_row )
	    {
	        for ( j = sel_col; j < numCols(); j++ )
	        {
		    if ( j == numCols() - 1 && i < numRows() - 1 )
		    {
		        color_matrix[i][j] = color_matrix[i + 1][0];
		    	color_names[i][j] = color_names[i + 1][0];
			alpha_matrix[i][j] = alpha_matrix[i + 1][0];
		    	updateCell( i, j );
		    }
		    else if ( j < numCols() - 1 )
		    {
		    	color_matrix[i][j] = color_matrix[i][j + 1];
		    	color_names[i][j] = color_names[i][j + 1];
			alpha_matrix[i][j] = alpha_matrix[i][j + 1];
		    	updateCell( i, j );
		    }
		    else if ( j == numCols() - 1 && i < numRows() - 1 )
		    {
		    	color_matrix[i][j] = invalid_color;
		    	color_names[i][j] = "";
			alpha_matrix[i][j] = -1;
		    	updateCell( i, j );
		    }
	    	}
	    }
	    else
	    {
	        for ( j = 0; j < numCols(); j++ )
	        {
		    if ( j == numCols() - 1 && i < numRows() - 1 )
		    {
		        color_matrix[i][j] = color_matrix[i + 1][0];
		    	color_names[i][j] = color_names[i + 1][0];
			alpha_matrix[i][j] = alpha_matrix[i + 1][0];
		    	updateCell( i, j );
		    }
		    else if ( j < numCols() - 1 )
		    {
		    	color_matrix[i][j] = color_matrix[i][j + 1];
		    	color_names[i][j] = color_names[i][j + 1];
			alpha_matrix[i][j] = alpha_matrix[i][j + 1];
		    	updateCell( i, j );
		    }
		    else if ( j == numCols() - 1 && i < numRows() - 1 )
		    {
		    	color_matrix[i][j] = invalid_color;
		    	color_names[i][j] = "";
			alpha_matrix[i][j] = -1;
		    	updateCell( i, j );
		    }
	    	}
	    }
	}
	if ( cur_col == sel_col && cur_row == sel_row )
	{
	    sel_row = -1;
	    sel_col = -1;
	    updateCell( cur_row, cur_col );
	}
    }
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:93,代码来源:custompalette.cpp

示例14: tableEIT


//.........这里部分代码省略.........
						break;
					}
				}
			}
			++it;
		}

		if ( nodesc )
			desc = new EventDesc();
		if ( parse ) {
			if ( !safeLen( buf+10 ) )
				goto stop;
			desc->duration = getTime( buf+7 );
			if ( !safeLen( buf+11 ) )
				goto stop;
			desc->running = getBits(buf,80,3);
			desc->sid = sid;
			desc->tid = tid;
			desc->tsid = tsid;
			desc->nid = nid;
			desc->lsn = lsn;
			desc->sn = sn;
			desc->eid = eid;
			desc->loop = cdt;
		}

		if ( desc->sn != sn ) {
			slist->unlock();
			return false;
		}
		if ( !safeLen( buf+12 ) )
			goto stop;
		loop = getBits(buf,84,12);
		buf +=12;
		length -=(12+loop);
		while ( loop>0 ) {
			if ( parse ) {
				if ( !safeLen( buf+1 ) )
					goto stop;
				switch ( getBits(buf,0,8) ) {
					case 0x4D :
						if ( !shortEventDesc( buf, desc ) )
							goto stop;
						break;
					case 0x4E :
						if ( !extEventDesc( buf, desc ) )
							goto stop;
						break;
					default :
						break;
				}
			}
			if ( !safeLen( buf+2 ) )
				goto stop;
			loop -=( getBits(buf,8,8)+2 );
			buf +=( getBits(buf,8,8)+2 );
		}
//out:
		if ( parse ) {
			if ( !nodesc ) {
				if ( start==desc->startDateTime )
					goto ifend;
				currentEvents->take( currentEvents->find( desc ) );
			}
			desc->startDateTime = start;
			for ( i=0; i<(int)currentEvents->count(); i++ ) {
				itdesc = currentEvents->at(i);
				if ( desc->startDateTime<itdesc->startDateTime ) {
					currentEvents->insert( i, desc );
					break;
				}
				itdesc = 0;
			}
			if ( !itdesc )
				currentEvents->append( desc );
		}
ifend:
		if ( parse )
			++(desc->sn);
		if ( nodesc ) {
			cur = QDateTime::currentDateTime();
			dt = desc->startDateTime;
			sec = desc->duration.hour()*3600+desc->duration.minute()*60+desc->duration.second();
			if ( dt.addSecs( sec )<cur || desc->title.length()<3 ) {
				currentEvents->remove( desc );
			}
			else
				desc->source = currentSrc->getSource();
		}

	}
	slist->unlock();
	return true;
stop:
	slist->unlock();
	fprintf( stderr, "Stop parsing EIT (%d:%d)\n", adapter, tuner );
	if ( nodesc )
		delete desc;
	return false;
}
开发者ID:iegor,项目名称:kdesktop,代码行数:101,代码来源:dvbevents.cpp


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