在QDir::entryInfoList中使用多个条件进行排序
Sorting with multiple conditions in QDir::entryInfoList
Qt的文档说QDir::entryInfoList
可以接受多种排序条件,但我不清楚如何做到。
This enum describes the sort options available to QDir, e.g. for entryList() and entryInfoList().
The sort value is specified by OR-ing together values from the following list:
QDir::Name 0x00 Sort by name.
QDir::Time 0x01 Sort by time (modification time).
:
(snip)
我想OR-ing
需要以某种方式完成。现在我想不出该怎么做(我想必须回去复习一下?)但有人能告诉我怎么做吗?非常感谢。
(无论如何,作为高级语言的文档,这个描述并不清楚?)
QDir::SortFlags
实际上是QFlags<QDir::SortFlag>
的typedef,是存储枚举值OR组合的类型安全方式。
因此,在您的案例中,您所做的只是将QDir::Name | QDir::Time
作为QDir::entryInfoList()
方法的自变量。
相关文章:
- 根据条件 C++ 对priority_queue进行重新排序
- C++ 中优先级队列的结构排序条件
- 根据某些条件对索引子集进行排序
- 是否可以在条件之前对加载或存储进行重新排序?
- 按两个条件对lambda表达C 进行排序
- 使用两个条件对对象的向量进行排序
- 按多个条件对向量进行排序
- 如何在没有 c++ 中的数组/算法的情况下对两个条件的字符串进行排序
- 使用条件变量并联对向量的向量进行排序
- 在 for 循环中重新排序测试条件:编译器错误?
- 根据此条件对队列进行排序
- 仅当条件适用时才排序 - std::sort
- 使用两个条件对结构数组进行排序 C++
- 插入最有效的数据结构,然后使用不同的条件进行排序
- 非标准条件排序算法STL c++
- 在QDir::entryInfoList中使用多个条件进行排序
- 合并排序算法 在一个条件下合并第三个数组中的两个数组
- 获取排序后的std::vector中满足某个条件的范围
- 我如何以相同的方式对两个向量排序,而条件只使用其中一个向量
- c++根据两个条件对排序