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


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

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


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

示例1: slotOKClicked

void VCXYPadProperties::slotOKClicked()
{
    QPtrList<XYChannelUnit>* list;

    // Update the X list
    list = m_parent->channelsX();

    list->setAutoDelete(true);
    list->clear();
    list->setAutoDelete(false);

    QListViewItemIterator xit(m_listX);

    while (xit.current())
    {
        list->append(createChannelUnit(*xit));
        ++xit;
    }

    // Update the Y list
    list = m_parent->channelsY();

    list->setAutoDelete(true);
    list->clear();
    list->setAutoDelete(false);

    QListViewItemIterator yit(m_listY);

    while (yit.current())
    {
        list->append(createChannelUnit(*yit));
        ++yit;
    }
    accept();
}
开发者ID:speakman,项目名称:qlc,代码行数:35,代码来源:vcxypadproperties.cpp

示例2: KAction

QPtrList<KAction> *AIMContact::customContextMenuActions()
{

	QPtrList<KAction> *actionCollection = new QPtrList<KAction>();
	if ( !m_warnUserAction )
	{
		m_warnUserAction = new KAction( i18n( "&Warn User" ), 0, this, SLOT( warnUser() ), this, "warnAction" );
	}
	m_actionVisibleTo = new KToggleAction(i18n("Always &Visible To"), "", 0,
	                                      this, SLOT(slotVisibleTo()), this, "actionVisibleTo");
	m_actionInvisibleTo = new KToggleAction(i18n("Always &Invisible To"), "", 0,
	                                        this, SLOT(slotInvisibleTo()), this, "actionInvisibleTo");
	
	bool on = account()->isConnected();

	m_warnUserAction->setEnabled( on );

	m_actionVisibleTo->setEnabled(on);
	m_actionInvisibleTo->setEnabled(on);

	SSIManager* ssi = account()->engine()->ssiManager();
	m_actionVisibleTo->setChecked( ssi->findItem( m_ssiItem.name(), ROSTER_VISIBLE ));
	m_actionInvisibleTo->setChecked( ssi->findItem( m_ssiItem.name(), ROSTER_INVISIBLE ));

	actionCollection->append( m_warnUserAction );

	actionCollection->append(m_actionVisibleTo);
	actionCollection->append(m_actionInvisibleTo);


	return actionCollection;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:32,代码来源:aimcontact.cpp

示例3: slotAddColor

void CustomPalette::slotAddColor( const QColor &new_color, int alpha )
{
    if ( cur_row == numRows() - 1 && cur_col == numCols() - 1 )
    {
	//do nothing
    }
    else if ( cur_col == numCols() - 1 )
    {
        color_matrix[cur_row][cur_col] = new_color;
	alpha_matrix[cur_row][cur_col] = alpha;
	int old_sel_row = sel_row;
	int old_sel_col = sel_col;
	sel_row = cur_row;
	sel_col = cur_col;
	if ( old_sel_row != -1 && old_sel_col != -1 )
	    updateCell( old_sel_row, old_sel_col );
	updateCell( cur_row, cur_col );
	cur_col = 0;
	cur_row++;

	QPtrList<Color> cl = k_toon -> document() -> getPalette() -> getColors();
	Color *n_color = new Color( ( float )new_color.red() / 255.0, ( float )new_color.green() / 255.0,
	                            ( float )new_color.blue() / 255.0, ( float )alpha / 100.0 );
	try {
	  cl.append( n_color );
	  k_toon -> document() -> getPalette() -> setColors( cl );
	  }
	catch(...)
	   {
	   delete n_color;
	   throw;
	   }
    }
    else
    {
        color_matrix[cur_row][cur_col] = new_color;
	alpha_matrix[cur_row][cur_col] = alpha;
	int old_sel_row = sel_row;
	int old_sel_col = sel_col;
	sel_row = cur_row;
	sel_col = cur_col;
	if ( old_sel_row != -1 && old_sel_col != -1 )
	    updateCell( old_sel_row, old_sel_col );
	updateCell( cur_row, cur_col );
	cur_col++;

	QPtrList<Color> cl = k_toon -> document() -> getPalette() -> getColors();
	Color *n_color = new Color( ( float )new_color.red() / 255.0, ( float )new_color.green() / 255.0,
	                            ( float )new_color.blue() / 255.0, ( float )alpha / 100.0 );
	try {
	  cl.append( n_color );
	  k_toon -> document() -> getPalette() -> setColors( cl );
	  }
	catch(...)
	   {
	   delete n_color;
	   throw;
	   }
    }
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:60,代码来源:custompalette.cpp

示例4: KActionSeparator

QPtrList<KAction> KDataToolAction::dataToolActionList( const QValueList<KDataToolInfo> & tools, const QObject *receiver, const char* slot )
{
    QPtrList<KAction> actionList;
    if ( tools.isEmpty() )
        return actionList;

    actionList.append( new KActionSeparator() );
    QValueList<KDataToolInfo>::ConstIterator entry = tools.begin();
    for( ; entry != tools.end(); ++entry )
    {
        QStringList userCommands = (*entry).userCommands();
        QStringList commands = (*entry).commands();
        Q_ASSERT(!commands.isEmpty());
        if ( commands.count() != userCommands.count() )
            kdWarning() << "KDataTool desktop file error (" << (*entry).service()->entryPath()
                        << "). " << commands.count() << " commands and "
                        << userCommands.count() << " descriptions." << endl;
        QStringList::ConstIterator uit = userCommands.begin();
        QStringList::ConstIterator cit = commands.begin();
        for (; uit != userCommands.end() && cit != commands.end(); ++uit, ++cit )
        {
            //kdDebug() << "creating action " << *uit << " " << *cit << endl;
            KDataToolAction * action = new KDataToolAction( *uit, *entry, *cit );
            connect( action, SIGNAL( toolActivated( const KDataToolInfo &, const QString & ) ),
                     receiver, slot );
            actionList.append( action );
        }
    }

    return actionList;
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例5: fixEnvVariables

void
Win32MakefileGenerator::processPrlFiles()
{
    QDict<void> processed;
    QPtrList<MakefileDependDir> libdirs;
    libdirs.setAutoDelete(TRUE);
    {
	QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
	for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
	    QString r = (*libpathit), l = r;
	    fixEnvVariables(l);
	    libdirs.append(new MakefileDependDir(r.replace("\"",""),
						 l.replace("\"","")));
	}
    }
    for(bool ret = FALSE; TRUE; ret = FALSE) {
	//read in any prl files included..
	QStringList l_out;
	QString where = "QMAKE_LIBS";
	if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
	    where = project->first("QMAKE_INTERNAL_PRL_LIBS");
	QStringList &l = project->variables()[where];
	for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
	    QString opt = (*it);
	    if(opt.startsWith("/")) {
		if(opt.startsWith("/LIBPATH:")) {
		    QString r = opt.mid(9), l = r;
		    fixEnvVariables(l);
		    libdirs.append(new MakefileDependDir(r.replace("\"",""),
							 l.replace("\"","")));
		}
	    } else {
		if(!processed[opt]) {
		    if(processPrlFile(opt)) {
			processed.insert(opt, (void*)1);
			ret = TRUE;
		    } else {
			for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
			    QString prl = mdd->local_dir + Option::dir_sep + opt;
			    if(processed[prl]) {
				break;
			    } else if(processPrlFile(prl)) {
				processed.insert(prl, (void*)1);
				ret = TRUE;
				break;
			    }
			}
		    }
		}
	    }
	    if(!opt.isEmpty())
		l_out.append(opt);
	}
	if(ret)
	    l = l_out;
	else
	    break;
    }
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:59,代码来源:winmakefile.cpp

示例6: addBlockNeighbour

void BlockGraph::addBlockNeighbour(PinNode *source, PinNode *target,
                                   QPtrList<PinNode> &seen)
{
    if (INSTANCEOF(target->parent()->model(), MuxModel)) {
        // iterate through output pins
        QPtrList<PinNode> neighbours = target->neighbours();
        for (QPtrListIterator<PinNode> it(neighbours); it != 0;
             ++it) {

            Q_ASSERT(target->parent() == (*it)->parent());

            if (!seen.contains(*it)) {
                seen.append(*it);
                QPtrList<PinNode> neighbours2 = (*it)->neighbours();
                for (QPtrListIterator<PinNode> it2(neighbours2); it2 != 0;
                     ++it2) {

                    addBlockNeighbour(source, *it2, seen);
                }
            }
        }
    }
    else {
//         qDebug(QString("added connection %1 -> %2")
//                .arg(source->parent()->model()->name())
//                .arg(target->parent()->model()->name()));
        source->parent()->addNeighbour(target->parent());
    }
}
开发者ID:BackupTheBerlios,项目名称:poa,代码行数:29,代码来源:blockgraph.cpp

示例7: startDrag

void FolderListView::startDrag()
{
QListViewItem *item = currentItem();
if (!item)
	return;

if (item == firstChild() && item->listView()->rootIsDecorated())
	return;//it's the project folder so we don't want the user to move it

QPoint orig = viewportToContents( viewport()->mapFromGlobal( QCursor::pos() ) );

QPixmap pix;
if (item->rtti() == FolderListItem::ListItemType)
	pix = QPixmap( folder_closed_xpm );
else
	pix = *item->pixmap (0);

QIconDrag *drag = new QIconDrag(viewport());
drag->setPixmap(pix, QPoint(pix.width()/2, pix.height()/2 ) );

QPtrList<QListViewItem> lst;
for (item = firstChild(); item; item = item->itemBelow())
	{
	if (item->isSelected())
		lst.append(item);
	}

emit dragItems(lst);
drag->drag();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:30,代码来源:folder.cpp

示例8: file

QPtrList< modulo > * libkernelinfo::modulo::obtenerLista()
{
    //Obtenemos nombres de todos los modulos disponibles en /proc/modules
    QPtrList<modulo>* listado = new QPtrList<modulo>();
    modulo *actual = NULL;
    QStringList lines;
    QFile file("/proc/modules" );
    if ( file.open( IO_ReadOnly ) ) {
        QTextStream stream( &file );
        QString line;
        QRegExp separator("\\s+");
        int i = 1;
        while ( !stream.atEnd() ) {
            line = stream.readLine(); // line of text excluding '\n'
            actual = new modulo();
            //Obtenemos campo nombres
            actual->setNombre(line.section(separator,0,0));
            actual->setTam(line.section(separator,1,1).toInt());
            actual->setDependencia(line.section(separator,3,3));                       
            listado->append(actual);
            //lines += line;
        }
        file.close();
    }
    return listado;
    //
}
开发者ID:Jona0712,项目名称:proyectos-kreig-usac,代码行数:27,代码来源:modulo.cpp

示例9: QInputContext

QUimInputContext::QUimInputContext( const char *imname, const char *lang )
        : QInputContext(), m_imname( imname ), m_lang( lang ), m_uc( 0 ),
        candwinIsActive( false )
{
#ifdef ENABLE_DEBUG
    qDebug( "QUimInputContext()" );
#endif

    contextList.append( this );

    // must be initialized before createUimContext() call
    if ( !m_HelperManager )
        m_HelperManager = new QUimHelperManager();

    if ( imname )
        m_uc = createUimContext( imname );

    psegs.setAutoDelete( true );
    psegs.clear();

    cwin = new CandidateWindow( 0 );
    cwin->setQUimInputContext( this );
    cwin->hide();

#ifdef Q_WS_X11
    if ( !mTreeTop )
        create_compose_tree();
    mCompose = new Compose( mTreeTop, this );
#endif
    mTextUtil = new QUimTextUtil( this );

    // read configuration
    readIMConf();
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:34,代码来源:quiminputcontext.cpp

示例10: setFixedExtent

void QDockArea::setFixedExtent( int d, QDockWindow *dw )
{
    QPtrList<QDockWindow> lst;
    QDockWindow *w;
    for ( w = dockWindows->first(); w; w = dockWindows->next() ) {
	if ( w->isHidden() )
	    continue;
	if ( orientation() == Horizontal ) {
	    if ( dw->y() != w->y() )
		continue;
	} else {
	    if ( dw->x() != w->x() )
		continue;
	}
	if ( orientation() == Horizontal )
	    d = QMAX( d, w->minimumHeight() );
	else
	    d = QMAX( d, w->minimumWidth() );
	if ( w->isResizeEnabled() )
	    lst.append( w );
    }
    for ( w = lst.first(); w; w = lst.next() ) {
	if ( orientation() == Horizontal )
	    w->setFixedExtentHeight( d );
	else
	    w->setFixedExtentWidth( d );
    }
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:28,代码来源:qdockarea.cpp

示例11: writeBlock

/*!
	\internal
	Writes \a len bytes to the socket from \a data and returns the
	number of bytes written. Returns -1 if an error occurred.
*/
Q_LONG cAsyncNetIOPrivate::writeBlock( const char* data, Q_ULONG len )
{
	// Invalid Socket -> Disconnected
	if ( !socket->isValid() )
	{
		socket->close();
		return 0;
	}

	if ( len == 0 )
		return 0;

	QByteArray* a = wba.last();

	if ( a && a->size() + len < 128 )
	{
		// small buffer, resize
		int i = a->size();
		a->resize( i + len );
		memcpy( a->data() + i, data, len );
	}
	else
	{
		// append new buffer
		a = new QByteArray( len );
		memcpy( a->data(), data, len );
		wba.append( a );
	}
	wsize += len;
	return len;
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:36,代码来源:asyncnetio.cpp

示例12: setupShourtcutTips

void Core::setupShourtcutTips(KXMLGUIClient * client)
{
  QPtrList<KXMLGUIClient> clients;
  if (client != 0)
    clients.append(client);
  else
    clients = TopLevel::getInstance()->main()->guiFactory()->clients();
  
  for( QPtrListIterator<KXMLGUIClient> it(clients); it.current(); ++it ) {
    KActionCollection *actionCollection = (*it)->actionCollection();
    for (int i = 0; i < actionCollection->count(); i++) {
      KAction *action = actionCollection->action(i);
            
      QString tooltip = action->toolTip();
      if (tooltip.isEmpty())
        tooltip = action->text().remove('&');
      else {
        int i = tooltip.findRev('(');
        if (i > 0) tooltip = tooltip.left(i).stripWhiteSpace();
      }

      QString shortcut = action->shortcutText();
      if (!shortcut.isEmpty())
        tooltip += " (" + shortcut + ")";
        action->setToolTip(tooltip);
      }
  }
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:28,代码来源:core.cpp

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

示例14: selectedItems

static void selectedItems( QPtrList<Kleo::KeyListViewItem> & result, QListViewItem * start ) {
  for ( QListViewItem * item = start ; item ; item = item->nextSibling() ) {
    if ( item->isSelected() )
      if ( Kleo::KeyListViewItem * i = Kleo::lvi_cast<Kleo::KeyListViewItem>( item ) )
	result.append( i );
    selectedItems( result, item->firstChild() );
  }
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例15: it

const QPtrList<Connection> Driver::connectionsList() const
{
	QPtrList<Connection> clist;
	QPtrDictIterator<Connection> it( d->connections );
	for( ; it.current(); ++it )
		clist.append( &(*it) );
	return clist;
}
开发者ID:,项目名称:,代码行数:8,代码来源:


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