Mega Code Archive

 
Categories / C++ / Qt
 

Add int to QList

#include <QtCore> #include <QDebug> int main() {   QList<int> intlist;   intlist << 2 << 5 << 2 << 4 << 2;   int findings = 0;   QListIterator<int> it(intlist);   while (it.findNext(2))     findings++;   qDebug() << findings; // output: 3   while (it.findPrevious(2))     findings--;   qDebug() << findings; // : 0   return 0; }