#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
最后
以上就是勤劳铃铛最近收集整理的关于自学QT之QMutableListIterator的全部内容,更多相关自学QT之QMutableListIterator内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复