我是靠谱客的博主 勤劳铃铛,这篇文章主要介绍自学QT之QMutableListIterator,现在分享给大家,希望可以做个参考。

#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()
boolfindNext(const T & value)
boolfindPrevious(const T & value)
boolhasNext() const
boolhasPrevious() const
voidinsert(const T & value)
T &next()
T &peekNext() const
T &peekPrevious() const
T &previous()
voidremove()
voidsetValue(const T & value) const
voidtoBack()
voidtoFront()
const T &value() const
T &value()
QMutableListIterator &operator=(QList<T> & list)

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

最后

以上就是勤劳铃铛最近收集整理的关于自学QT之QMutableListIterator的全部内容,更多相关自学QT之QMutableListIterator内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(119)

评论列表共有 0 条评论

立即
投稿
返回
顶部