本文整理汇总了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;
}
示例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() );
}
示例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();
}
示例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()));
}