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


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

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


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

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

示例2: selectedItems

void
QueueList::moveSelectedDown() // SLOT
{
    QPtrList<QListViewItem> list = selectedItems();

    for( QListViewItem *item  = list.last(); item; item = list.prev() )
    {
        QListViewItem *after = item->nextSibling();

        if( !after )
            continue;

        moveItem( item, 0, after );
    }

    ensureItemVisible( list.last() );
}
开发者ID:tmarques,项目名称:waheela,代码行数:17,代码来源:queuemanager.cpp

示例3: saveSettings

MainWindow::~MainWindow()
{
  saveSettings();

  QPtrList<KParts::Part> parts = *mPartManager->parts();

  for ( KParts::Part *p = parts.last(); p; p = parts.prev() ) {
    delete p;
    p = 0;
  }

  Prefs::self()->writeConfig();
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: replaceVariable

void VariablesListView::replaceVariable(DebuggerVariable* oldvar, DebuggerVariable* newvar)
{ 
  KListViewItem * item;
  
  // Remove children that doesen't exist anymore
  QPtrList<DebuggerVariable> oldlist = oldvar->values();
  for(DebuggerVariable* oldchild = oldlist.last(); oldchild; oldchild = oldlist.prev())
  {
    bool found = false;
    QPtrList<DebuggerVariable> newlist = newvar->values();
    for(DebuggerVariable* newchild = newlist.last(); newchild; newchild = newlist.prev())
    {
      if(newchild->name() == oldchild->name())
      {
        found = true;
        break;
      }
    }
    if(!found)
      oldvar->deleteChild(oldchild);
  }

  // Update and add children
  QPtrList<DebuggerVariable> newlist = newvar->values();
  for(DebuggerVariable* newchild = newlist.last(); newchild; newchild = newlist.prev())
  {
    bool found = false;
    QPtrList<DebuggerVariable> oldlist = oldvar->values();
    for(DebuggerVariable* oldchild = oldlist.last(); oldchild; oldchild = oldlist.prev())  
    {
      if(newchild->name() == oldchild->name())
      {
        found = true;
        replaceVariable( oldchild, newchild);
        break;
      }
    }
    if(!found)
    {
      DebuggerVariable* child = new DebuggerVariable();
      item = new KListViewItem(oldvar->item());
      child->setItem(item);
      replaceVariable( child, newchild);
      oldvar->append(child);
    }
  }
  
  item = oldvar->item();
  
  if(oldvar->value() != newvar->value())
    item->setPixmap(VariablesListViewColumns::Status, SmallIcon("ok"));
  else
    item->setPixmap(VariablesListViewColumns::Status, KPixmap());
  
  oldvar->copy(newvar, false);
  
  item->setText(VariablesListViewColumns::Name, oldvar->name());
  item->setText(VariablesListViewColumns::Type, oldvar->typeName());
  item->setText(VariablesListViewColumns::Size, oldvar->sizeName());
  item->setText(VariablesListViewColumns::Value, (newvar->isScalar() ? oldvar->value() : QString()));
  
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:62,代码来源:variableslistview.cpp


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