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


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

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


在下文中一共展示了QPtrList::next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createContents

void Chaser::createContents(QPtrList <QString> &list)
{
  unsigned long functionId = 0;
  
  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Function"))
	{
	  functionId = list.next()->toULong();
	  
	  Function* function = _app->doc()->searchFunction(functionId);
	  if (function != NULL)
	    {
	      addStep(function);
	    }
	  else
	    {
	      qDebug("Unable to find member for chaser <" + name() + ">");
	    }

	  functionId = 0;
	}
      else
	{
	  // Unknown keyword
	  list.next();
	}
    }
}
开发者ID:speakman,项目名称:qlc,代码行数:34,代码来源:chaser.cpp

示例3: if

static PyObject *wpParty_getAttr(wpParty *self, char *name)
{
	cParty *party = self->party;

	if (!strcmp(name, "leader"))
	{
		return party->leader()->getPyObject();
	}
	else if (!strcmp(name, "members"))
	{
		QPtrList<cPlayer> members = party->members();
		PyObject *list = PyList_New(0);
		for (P_PLAYER member = members.first(); member; member = members.next())
			PyList_Append(list, member->getPyObject());
		return list;
	}
	else if (!strcmp(name, "canidates"))
	{
		QPtrList<cPlayer> canidates = party->canidates();
		PyObject *list = PyList_New(0);
		for (P_PLAYER canidate = canidates.first(); canidate; canidate = canidates.next())
			PyList_Append(list, canidate->getPyObject());
		return list;
	}
	else if (!strcmp(name, "lootingallowed"))
	{
		QPtrList<cPlayer> lootlist = party->lootingAllowed();
		PyObject *list = PyList_New(0);
		for (P_PLAYER member = lootlist.first(); member; member = lootlist.next())
			PyList_Append(list, member->getPyObject());
		return list;
	}

	return Py_FindMethod(wpPartyMethods, (PyObject*)self, name);
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:35,代码来源:party.cpp

示例4: load

/**
 * Load settings from file
 */
void Settings::load()
{
	// Search for a file from user's home directory
	QString path = QString(getenv("HOME")) +
		QString("/") + QString(KQLCUserDir);

	QString fileName = path + QString("/") + QString(KConfigFile);
	QPtrList <QString> list;

	if (FileHandler::readFileToList(fileName, list) == true)
	{
		for (QString* s = list.first(); s != NULL; s = list.next())
		{
			if (*s == QString("Entry"))
			{
				if (*(list.next()) == QString("General"))
				{
					createContents(list);
				}
			}
		}
	}

	while (!list.isEmpty())
	{
		delete list.take(0);
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:31,代码来源:settings.cpp

示例5: createWidget

void VirtualConsole::createWidget(QPtrList <QString> &list)
{
    QString t;

    for (QString* s = list.next(); s != NULL; s = list.next())
    {
        if (*s == QString("Entry"))
        {
            s = list.prev();
            break;
        }
        else if (*s == QString("Frame"))
        {
            if (m_drawArea == NULL)
            {
                m_drawArea = new VCFrame(this);
                m_drawArea->init();
                m_drawArea->setBottomFrame(true);
                m_drawArea->setFrameStyle(QFrame::Panel | QFrame::Sunken);

                m_layout->addWidget(m_drawArea, 1);

                m_drawArea->createContents(list);

                m_drawArea->show();
            }
            else
            {
                VCFrame* w = new VCFrame(m_drawArea);
                w->init();
                w->createContents(list);
            }
        }
        else if (*s == QString("Label"))
        {
            VCLabel* w = new VCLabel(m_drawArea);
            w->init();
            w->createContents(list);
        }
        else if (*s == QString("Button"))
        {
            VCButton* w = new VCButton(m_drawArea);
            w->init();
            w->createContents(list);
        }
        else if (*s == QString("Slider"))
        {
            VCDockSlider* s = new VCDockSlider(m_drawArea);
            s->init();
            s->createContents(list);
        }
        else
        {
            // Unknown keyword, skip
            list.next();
        }
    }
}
开发者ID:speakman,项目名称:qlc,代码行数:58,代码来源:virtualconsole.cpp

示例6: inspectTuplet

void NPmxExport::inspectTuplet(NPlayable *elem, int staff_nr, int barnr_) {
	QPtrList<NPlayable> *tupletlist;
	badmeasure *bad;
	int len1, len2;
	NPlayable *elem2;
	bool len2set = false;

	tupletlist = elem->getTupletList();

	if ((int)(tupletlist->count()) != elem->getNumNotes()) {
		elem2 = tupletlist->first();
		len1 = len2 = elem2->getSubType();
		for (elem2 = tupletlist->next(); elem2; elem2 = tupletlist->next()) {
			if (elem2->getSubType() != len1) {
				if (len2set) {
					if (elem2->getSubType() != len2) {
						bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
						badlist_.append(bad);
					}
				}
				else {
					len2set = true;
					len2 = elem2->getSubType();
				}
			}
		}
		if (len2set) {
			if (len1 != 2*len2 && len2 != 2*len1) {
				bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
				badlist_.append(bad);
			}
			if (len1 < len2)  {
				tupletBase_ = len1;
			}
			else {
				tupletBase_ = len2;
			}
		}
		else {
			tupletBase_ = len1;
		}
						
	}
	else {
		tupletBase_ = tupletlist->getFirst()->getSubType();
	}
	if (tupletlist->getLast()->getType() == T_REST) {
		bad = new badmeasure(PMX_ERR_TUPLET_ENDS_REST, staff_nr, barnr_, 0, 0);
		badlist_.append(bad);
	}
}
开发者ID:BackupTheBerlios,项目名称:noteedit-svn,代码行数:51,代码来源:pmxexport.cpp

示例7: createContents

/*
 * Create contents from list created by FileHandler
 */
void Settings::createContents(QPtrList <QString> &list)
{
	for (QString* s = list.next(); s != NULL; s = list.next())
	{
		if (*s == QString("Entry"))
		{
			s = list.prev();
			break;
		}
		else
		{
			set(*s, *(list.next()));
		}
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:18,代码来源:settings.cpp

示例8: 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

示例9: O

void
QueueManager::addItems( QListViewItem *after )
{
    /*
        HACK!!!!! We can know which items where dragged since they should still be selected
        I do this, because:
        - Dragging items from the playlist provides urls
        - Providing urls, requires iterating through the entire list in order to find which
          item was selected.  Possibly a very expensive task - worst case: O(n)
        - After a drag, those items are still selected in the playlist, so we can find out
          which PlaylistItems were dragged by selectedItems();
    */

    if( !after )
        after = m_listview->lastChild();

    QPtrList<QListViewItem> list = Playlist::instance()->selectedItems();

    for( QListViewItem *item = list.first(); item; item = list.next() )
    {
#define item static_cast<PlaylistItem*>(item)
        QValueList<PlaylistItem*> current = m_map.values();

        if( current.find( item ) == current.end() ) //avoid duplication
        {
            QString title = i18n("%1 - %2").arg( item->artist(), item->title() );

            after = new QueueItem( m_listview, after, title );
            m_map[ after ] = item;
        }
#undef item
    }

}
开发者ID:tmarques,项目名称:waheela,代码行数:34,代码来源:queuemanager.cpp

示例10: setProperty

void CSSStyleDeclarationImpl::setProperty ( const DOMString &propertyString)
{
    DOMString ppPropertyString = preprocess(propertyString.string(),true);
    QPtrList<CSSProperty> *props = parseProperties(ppPropertyString.unicode(),
						ppPropertyString.unicode()+ppPropertyString.length());
    if(!props || !props->count())
	return;

    props->setAutoDelete(false);

    if(!m_lstValues) {
	m_lstValues = new QPtrList<CSSProperty>;
	m_lstValues->setAutoDelete( true );
    }

    CSSProperty *prop = props->first();
    while( prop ) {
	removeProperty(prop->m_id, false);
	m_lstValues->append(prop);
 	prop = props->next();
    }

    delete props;
    setChanged();
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:25,代码来源:css_valueimpl.cpp

示例11: loadFrames

void TLFrameSequenceLayout::loadFrames( QPtrList<Layer> layers )
{
    number_of_frame_sequences = 0;
    max_used_frames = 0;
    delete current_frame_sequence;
    list_of_frame_sequences.clear();

    Layer *l_it;
    for ( l_it = layers.first(); l_it; l_it = layers.next() )
    {
	QPtrList<KeyFrame> keyframes = l_it -> keyFrames();
        number_of_frame_sequences++;

    	TLFrameSequence *new_frame_sequence = new TLFrameSequence( number_of_frame_sequences, viewport(), this );
	if ( l_it == layers.getFirst() )
	    current_frame_sequence = new_frame_sequence;
    	addChild( new_frame_sequence, 0, ( number_of_frame_sequences - 1 ) * new_frame_sequence -> height() );
    	connect( new_frame_sequence, SIGNAL( frameInserted() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( frameRemoved() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( keyframeRemoved( int ) ), SIGNAL( keyframeRemovedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenCreated( int ) ), SIGNAL( motionTweenCreatedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenRemoved( int ) ), SIGNAL( motionTweenRemovedToES( int ) ) );
	list_of_frame_sequences.append( new_frame_sequence );
    	last_frame_sequence = new_frame_sequence;
    	updateContentSize();

	new_frame_sequence -> loadFrames( keyframes );
    }
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:29,代码来源:tlframesequencelayout.cpp

示例12: EnumFormatEtc

STDMETHODIMP QOleDataObject::EnumFormatEtc( DWORD dwDir, IEnumFORMATETC **ppenumFormatEtc )
{

    if ( dwDir == DATADIR_SET )
        return E_NOTIMPL;

    int count = 0;

    while ( m_dragObj->format( count ) )
        count++;

    int *formats = new int[ count ];
    for ( int i = 0; i < count; i++ ) {
        const char *mime = m_dragObj->format( i );
        QPtrList<QWindowsMime> all = QWindowsMime::all();
        for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
            int cf = c->cfFor( mime );
            if ( cf ) {
                formats[ i ] = cf;
                break;
            }
        }
    }

    qIEnumFORMATETC *pEnum = new qIEnumFORMATETC( formats, count );
    pEnum->AddRef();
    *ppenumFormatEtc = pEnum;

    delete[] formats;

    return ResultFromScode( S_OK );
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:32,代码来源:qdnd_win.cpp

示例13: slotRefreshWindowMenu

void App::slotRefreshWindowMenu()
{
	QWidget* widget;
	int id = 0;

	QPtrList <QWidget> wl = workspace()->windowList();

	m_windowMenu->clear();
	m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_sidetree.png")),
				 "Cascade", this, SLOT(slotWindowCascade()),
				 0, ID_WINDOW_CASCADE);
	m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_left_right.png")),
				 "Tile", this, SLOT(slotWindowTile()),
				 0, ID_WINDOW_TILE);
	m_windowMenu->insertSeparator();

	for (widget = wl.first(); widget != NULL; widget = wl.next())
	{
		m_windowMenu->insertItem(widget->caption(), id);
		if (widget->isVisible() == true)
		{
			m_windowMenu->setItemChecked(id, true);
		}
		id++;
	}

	connect(m_windowMenu, SIGNAL(activated(int)),
		this, SLOT(slotWindowMenuCallback(int)));
}
开发者ID:speakman,项目名称:qlc,代码行数:29,代码来源:app.cpp

示例14: GetDataHere

STDMETHODIMP QOleDataObject::GetDataHere( FORMATETC *pformatetc, STGMEDIUM *pmedium )
{
    // is data is in our format?
    HRESULT hr = QueryGetData( pformatetc );
    if ( hr != S_OK )
        return hr;

    if ( pmedium->tymed != TYMED_HGLOBAL )
        return DV_E_TYMED;

    if ( !pmedium->hGlobal )
        return STG_E_MEDIUMFULL;

    HGLOBAL hGlobal = pmedium->hGlobal;
    uint size = GlobalSize( hGlobal );

    int cf = pformatetc->cfFormat;
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            QByteArray ba = m_dragObj->encodedData( mime );
            if ( ba.size() > size )
                return STG_E_MEDIUMFULL;
            memcpy ( GlobalLock ( hGlobal ), ba.data(), ba.size() );
            GlobalUnlock ( hGlobal );
            return S_OK;
        }
    }
    return E_UNEXPECTED;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:31,代码来源:qdnd_win.cpp

示例15: provides

bool QDropEvent::provides( const char * mimeType ) const
{
#ifdef DEBUG_QDND_WIN
    qDebug( "QDropEvent::provides ( %s )", mimeType );
#endif

    if ( !pIDataObject )
        return false;

    FORMATETC fmtMemory = { 0,
                            NULL,
                            DVASPECT_CONTENT,
                            -1,
                            TYMED_HGLOBAL };

    /* Search all available mimes for mimeType and look if pIDataObject
       can give us data in this clipboard format */
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        int cf = c->cfFor( mimeType );
        if ( c->canConvert( mimeType, cf ) ) {
            fmtMemory.cfFormat = cf;
            if ( pIDataObject->QueryGetData( &fmtMemory ) == S_OK ) {
                return true;
            }

        }
    }
    return false;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:30,代码来源:qdnd_win.cpp


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