本文整理汇总了C++中QLinkedList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::end方法的具体用法?C++ QLinkedList::end怎么用?C++ QLinkedList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}
}
示例2: skip
qint64 SetSrcAction::skip(QLinkedList<Action*> &list, QLinkedList<Action*>::iterator &it)
{
bool metSD = false;
qint64 skipCost = cost;
delete this;
it = list.erase(it);
while (it != list.end() && (*it)->type() != ActionType::SetSrc)
if ((*it)->type() == ActionType::SetDest)
if (metSD)
{
--it;
skipCost += (*it)->actionCost();
delete *it;
it = list.erase(it);
++it;
}
else
{
metSD = true;
++it;
}
else
{
skipCost += (*it)->actionCost();
delete *it;
it = list.erase(it);
}
return skipCost;
}
示例3: 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;
}
示例4:
void
MainWindow::deviceRemoved(QDBusMessage message)
{
int index;
QString devicePath;
#ifdef USEHAL
devicePath = message.arguments().at(0).toString();
if (devicePath.startsWith("/org/freedesktop/Hal/devices/storage_serial"))
#else
QDBusObjectPath path = message.arguments().at(0).value<QDBusObjectPath>();
devicePath = path.path();
if (devicePath.startsWith("/org/freedesktop/UDisks/devices/"))
#endif
{
QLinkedList<DeviceItem *> list = pPlatform->getDeviceList();
QLinkedList<DeviceItem *>::iterator i;
for (i = list.begin(); i != list.end(); ++i)
{
if ((*i)->getUDI() == devicePath)
{
if (removeMenuItem((*i)->getDisplayString()) != -1)
{
pPlatform->removeDeviceFromList(devicePath);
break;
}
}
}
}
}
示例5: slotPopulatePhotoSetComboBox
void FlickrWindow::slotPopulatePhotoSetComboBox()
{
kDebug() << "slotPopulatePhotoSetComboBox invoked";
if (m_talker && m_talker->m_photoSetsList)
{
QLinkedList <FPhotoSet> *list = m_talker->m_photoSetsList;
m_albumsListComboBox->clear();
m_albumsListComboBox->insertItem(0, i18n("<Photostream Only>"));
m_albumsListComboBox->insertSeparator(1);
QLinkedList<FPhotoSet>::iterator it = list->begin();
int index = 2, curr_index = 0;
while (it != list->end())
{
FPhotoSet photoSet = *it;
QString name = photoSet.title;
// Store the id as user data, because the title is not unique.
QVariant id = QVariant(photoSet.id);
if (id == m_talker->m_selectedPhotoSet.id)
{
curr_index = index;
}
m_albumsListComboBox->insertItem(index++, name, id);
++it;
}
m_albumsListComboBox->setCurrentIndex(curr_index);
}
}
示例6: getActiveTransfers
bool QED2KSession::hasActiveTransfers() const
{
QLinkedList<QED2KHandle> torrents = getActiveTransfers();
QLinkedList<QED2KHandle>::iterator torrentIT;
for (torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
const QED2KHandle h(*torrentIT);
if (h.is_valid() && !h.is_seed() && !h.is_paused() )
return true;
}
return false;
}
示例7: getContentListStrings
QStringList NfcTarget::getContentListStrings()
{
QStringList cl;
QLinkedList< QPair<QVariant,QString> > ll = this->getContentList();
QLinkedList< QPair<QVariant,QString> >::iterator it;
for ( it = ll.begin(); it!= ll.end(); ++it ) {
cl << QString::number ( ( *it ).first.toInt() ) + QString ( ": " )
+ ( *it ).second + QString ( "\n" );
}
return cl;
}
示例8: 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();
}
示例9: main
int main ()
{
int myints[] = {75,23,65,42,13};
QLinkedList<int> myQLinkedList (myints,myints+5);
QLinkedList<int>::iterator it;
it = myQLinkedList.end();
it--;
assert(*it != 13);
cout << endl;
return 0;
}
示例10: 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++;
}
}
示例11: saveConditions
void Odf::saveConditions(const Conditions *conditions, KoGenStyle ¤tCellStyle, ValueConverter *converter)
{
//todo fix me with kspread old format!!!
if (conditions->isEmpty())
return;
QLinkedList<Conditional> list = conditions->conditionList();
QLinkedList<Conditional>::const_iterator it;
int i = 0;
for (it = list.begin(); it != list.end(); ++it, ++i) {
Conditional conditional = *it;
//<style:map style:condition="cell-content()=45" style:apply-style-name="Default" style:base-cell-address="Sheet1.E10"/>
QMap<QString, QString> map;
map.insert("style:condition", saveConditionValue(conditional, converter));
map.insert("style:apply-style-name", conditional.styleName);
if (!conditional.baseCellAddress.isEmpty())
map.insert("style:base-cell-address", conditional.baseCellAddress);
currentCellStyle.addStyleMap(map);
}
}
示例12: UpdateHistory
void BatteryHistoryDialog::UpdateHistory (const QLinkedList<BatteryHistory>& hist)
{
QVector<double> xdata (hist.size ());
QVector<double> percents (hist.size ());
QVector<double> energy (hist.size ());
int i = 0;
std::for_each (hist.begin (), hist.end (),
[&xdata, &percents, &energy, &i] (const BatteryHistory& bh)
{
percents [i] = bh.Percentage_;
energy [i] = bh.EnergyRate_;
xdata [i] = i;
++i;
});
Percent_->setSamples (xdata, percents);
Energy_->setSamples (xdata, energy);
Ui_.PercentPlot_->replot ();
}
示例13: addMenuItem
void
MainWindow::reloadDeviceList(const char *cmddevice)
{
int dev = -1;
QLinkedList<DeviceItem *> list = pPlatform->getDeviceList();
QLinkedList<DeviceItem *>::iterator i;
for (i = list.begin(); i != list.end(); ++i)
{
if (!(*i)->getPath().isEmpty())
if (deviceComboBox->findText((*i)->getDisplayString()) == -1)
addMenuItem((*i)->getDisplayString());
if (cmddevice != NULL)
if ((*i)->getPath().compare(cmddevice) == 0)
dev = deviceComboBox->findText((*i)->getDisplayString(), 0);
}
if (dev != -1)
deviceComboBox->setCurrentIndex(dev);
}
示例14: convertNodes
void boxAvail::convertNodes(QLinkedList<BareNode*> src){
QLinkedList<BareNode*>::Iterator bnIt;
itemNode *node;
itemLinker *linker;
int pos=1;
int id;
QString info;
int link;
for (bnIt=src.begin (); bnIt!=src.end (); ++bnIt){
id = (*bnIt)->getId();
info = (*bnIt)->getInfo();
link = (*bnIt)->getLink();
node = new itemNode(&Server,pos,id,info,link, this);
source << node;
if (link){
linker = new itemLinker(pos, &Server, this);
source << linker;
}
++pos;
}
}
示例15: app
int
main (int argc, char *argv[])
{
int c;
char *device = NULL;
char *file = NULL;
bool unsafe = false;
bool maximized = false;
bool listMode = false;
bool kioskMode = false;
qDebug() << "Starting up...";
#if defined(Q_OS_UNIX)
#if !defined(KIOSKHACK) && !defined(USEUDISKS2)
if (getuid() != 0)
qFatal("You must run this program as the root user.");
#endif
#endif
while ((c = getopt (argc, argv, "mlkvuhd:f:")) != -1)
{
switch (c)
{
case 'h':
fprintf(stdout, "Usage:\t%s [-d <device>] [-f <raw file>] [-u] [-l] [-v]\n", argv[0]);
fprintf(stdout, "Flashes a raw disk file to a device\n\n");
fprintf(stdout, "-d <device>\t\tSpecify a device, for example: /dev/sdc\n");
fprintf(stdout, "-f <raw file>\t\tSpecify the file to write\n");
fprintf(stdout, "-k\t\t\tOperate in \"kiosk mode\", only listing disks smaller than 200GB\n");
fprintf(stdout, "-l\t\t\tList valid USB devices\n");
fprintf(stdout, "-m\t\t\tMaximize the window\n");
fprintf(stdout, "-u\t\t\tOperate in unsafe mode, listing all disks, not just removable ones\n");
fprintf(stdout, "-v\t\t\tVersion and author information\n");
exit(0);
case 'u':
unsafe = true;
break;
case 'd':
device = strdup(optarg);
break;
case 'f':
file = strdup(optarg);
break;
case 'l':
listMode = true;
break;
case 'k':
kioskMode = true;
break;
case 'v':
fprintf(stdout, "SUSE Studio Imagewriter %s\nWritten by Matt Barringer <[email protected]>\n", APP_VERSION);
exit(0);
break;
case 'm':
maximized = true;
break;
default:
break;
}
}
QApplication app(argc, argv);
#ifdef USEHAL
PlatformHal *platform = new PlatformHal(kioskMode, unsafe);
#elif USEUDISKS2
PlatformUdisks2 *platform = new PlatformUdisks2(kioskMode, unsafe);
#else
PlatformUdisks *platform = new PlatformUdisks(kioskMode, unsafe);
#endif
platform->findDevices();
if (listMode)
{
QLinkedList<DeviceItem *> list = platform->getDeviceList();
QLinkedList<DeviceItem *>::iterator i;
for (i = list.begin(); i != list.end(); ++i)
{
if (!(*i)->getPath().isEmpty())
fprintf(stdout, "%s\n", (*i)->getPath().toLatin1().data());
}
exit(0);
}
MainWindow window(platform, device, file, unsafe, maximized);
if (maximized)
{
window.showMaximized();
}
else
{
window.show();
}
return app.exec();
}