Qt中foreach的用法
来源:互联网 发布:多系统引导软件 编辑:程序博客网 时间:2024/04/30 13:49
Qt中foreach的用法
If you just want to iterate over all the items in a container in order, you can use Qt'sforeach keyword. The keyword is a Qt-specific addition to the C++ language, and is implemented using the preprocessor.
Its syntax is: foreach (variable, container)statement. For example, here's how to use foreach to iterate over aQLinkedList<QString>:
QLinkedList<QString> list; ... QString str; foreach (str, list) qDebug() << str;
如果你想有序迭代容器中的所有项可以使用关键字foreach,这是qt对C++的特定补充,并通过预处理器实现。他的语法是:foreach (variable, container) +语句;这儿varible就相当于varible=container.item,只不过这个item会从container的头遍历到尾罢了。
QLinkedList<QString> list;
QLinkedListIterator<QString> i(list); while (i.hasNext()) qDebug() << i.next();这两个语句达到的目的是一样的
- Qt中foreach的用法
- Qt中foreach的用法
- Qt中foreach的用法
- Qt中foreach的用法
- Qt中foreach的用法
- QT--foreach的用法
- Qt'中foreach的实现
- QT中foreach的使用
- Qt foreach 和 QTextCodec类的用法
- php中foreach()的用法
- php中foreach()的用法
- php中foreach()的用法
- jstl中foreach的用法
- php中foreach()的用法
- javascript中foreach的用法
- javascript中foreach的用法
- javascript中foreach的用法
- javascript中foreach的用法
- struts注册信息验证的实现描述附带代码
- cron表达式(quartz中时间表达式)
- 第三周任务2
- 能帮你职场突围的9个好习惯
- gvim菜单栏不显示了
- Qt中foreach的用法
- JMF实现将从摄像头和麦克读取的媒体信息保存成视频文件
- 淘宝网手机客户端开发(一)目录篇
- android资料总结
- 类QSettings使用
- plsql 使用技巧 及 语句集锦
- Linux错误码编码
- SDKMisc.h
- 1423. 魔王bug的2色定理