自学QT之QMutableListIterator

匿名 (未验证) 提交于 2019-12-03 00:03:02
#include <QCoreApplication> #include <QList> #include <QDebug> int main(int argc, char *argv[]) {     QCoreApplication a(argc, argv);     QList<int> mylist;     for(int i=0;i<10;i++)     {         mylist.append(i);     }     QMutableListIterator<int> iter(mylist);     while(iter.hasNext())     {         int i=iter.next();         if(i==5)         {             iter.remove();         }     }     iter.toFront();      while(iter.hasNext())     {          qDebug()<<iter.next();      }      return a.exec(); }

上面代码运行的结果:

官方给出的函数有:

QMutableListIterator(QList<T> & list)
~QMutableListIterator()
bool findNext(const T & value)
bool findPrevious(const T & value)
bool hasNext() const
bool hasPrevious() const
void insert(const T & value)
T & next()
T & peekNext() const
T & peekPrevious() const
T & previous()
void remove()
void setValue(const T & value) const
void toBack()
void toFront()
const T & value() const
T & value()
QMutableListIterator & operator=(QList<T> & list)

转载于:https://my.oschina.net/u/2505464/blog/542349

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!