本文整理汇总了C++中QLinkedList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::insert方法的具体用法?C++ QLinkedList::insert怎么用?C++ QLinkedList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sortZList
void QgsComposition::sortZList()
{
if ( mItemZList.size() < 2 )
{
return;
}
QLinkedList<QgsComposerItem*>::const_iterator lIt = mItemZList.constBegin();
QLinkedList<QgsComposerItem*> sortedList;
for ( ; lIt != mItemZList.constEnd(); ++lIt )
{
QLinkedList<QgsComposerItem*>::iterator insertIt = sortedList.begin();
for ( ; insertIt != sortedList.end(); ++insertIt )
{
if (( *lIt )->zValue() < ( *insertIt )->zValue() )
{
break;
}
}
sortedList.insert( insertIt, ( *lIt ) );
}
mItemZList = sortedList;
}
示例2: modifyOrder
void modifyOrder(QLinkedList<BidOrAsk> &queue, BidOrAsk &bidOrAsk) {
auto r = std::find(queue.begin(), queue.end(), bidOrAsk);
if (r != queue.end()) {
BidOrAsk original = *r;
Q_ASSERT (original.id() == bidOrAsk.id());
if (original.price() != bidOrAsk.price() ||
original.volume() > bidOrAsk.volume()) {
// remove and re-add to loose position
queue.erase(r);
original.setPrice(bidOrAsk.price());
original.setVolume(bidOrAsk.volume());
// since this simulation happens long past,
// we can't use the current time.
original.setTime(bidOrAsk.time());
original.setDate(bidOrAsk.date());
queue.insert(std::lower_bound(queue.begin(),
queue.end(),
bidOrAsk),
bidOrAsk);
} else {
// if only the volume has decreased, it
// doesn't loose its position.
original.setVolume(bidOrAsk.volume());
}
}
}
示例3: main
int main ()
{
QLinkedList<int> myints;
cout << "0. size: " << (int) myints.size() << endl;
assert(myints.size() == 0);
for (int i=0; i<10; i++) myints.push_back(i);
cout << "1. size: " << (int) myints.size() << endl;
assert(myints.size() == 10);
myints.insert (myints.begin(),10);
cout << "2. size: " << (int) myints.size() << endl;
assert(myints.size() == 11);
myints.pop_back();
cout << "3. size: " << (int) myints.size() << endl;
assert(myints.size() == 10);
return 0;
}
示例4: doNotVerifyBootBlock
void DeviceVerifyPlanner::doNotVerifyBootBlock(QLinkedList<Device::MemoryRange>& verifyList)
{
Device::MemoryRange firstHalf;
QLinkedList<Device::MemoryRange>::iterator it = verifyList.begin();
while(it != verifyList.end())
{
// S E
// S | E
// S | E
// S | | E
//
// | S E
// S E |
if(!((it->start <= device->startBootloader && it->end <= device->startBootloader) ||
(it->start >= device->endBootloader && it->end >= device->endBootloader)))
{
// This transaction would verify over bootloader memory, which may fail if
// we haven't (or can't) read the device out.
if(it->start == device->startBootloader && it->end == device->endBootloader)
{
it = verifyList.erase(it);
continue;
}
if(it->start == device->startBootloader)
{
it->start = device->endBootloader;
}
else if(it->end == device->endBootloader)
{
it->end = device->startBootloader;
}
else
{
firstHalf.start = device->endBootloader;
firstHalf.end = it->end;
it->end = device->startBootloader;
if(firstHalf.start < firstHalf.end)
{
verifyList.insert(it, firstHalf);
}
}
}
it++;
}
}
示例5: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QLinkedList<QString> linkList;
linkList.append("Bangaluru");
linkList.append("Mumbai");
linkList.append("Delhi");
linkList.append("Gandhinagara");
qDebug() << "1-Number of Items =" << linkList.count();
QLinkedList<QString>::iterator j = qFind(linkList.begin(),linkList.end(),"Varanasi");
linkList.insert(j,"Bhopal");
QLinkedList<QString>::iterator i;
for (i = linkList.begin(); i != linkList.end(); ++i)
qDebug() << *i << endl;
qDebug() << "2-Number of Items =" << linkList.count();
return a.exec();
}