Qt中foreach的用法
来源:互联网 发布:淘宝怎么设置分类 编辑:程序博客网 时间:2024/06/10 02:53
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 useforeach 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的用法
- Javascript 分页 完美封装
- UVA 11426 - GCD - Extreme (II)
- Source Insight 批量注释 多行注释宏
- win7下LoadRunner监控windows资源图报错
- Android平台下与服务器数据库通信的方法
- Qt中foreach的用法
- Maven常用命令
- 判断鼠标是否在接收键盘事件的控件上
- LR检查点小结
- 憋屈
- 在VC下执行DOS命令
- 异地备份和还原方案(还原)
- 从aspx到cshtml常见错误及正确书写方法
- 逻辑回归(Logistic Regression)