The QTreeWidgetItemIterator class provides a way to iterate over the items in a QTreeWidget 实例。 更多...
The QTreeWidgetItemIterator class provides a way to iterate over the items in a QTreeWidget 实例。
The iterator will walk the items in a pre-order traversal order, thus visiting the parent node before it continues to the child nodes.
For example, the following code examples each item in a tree, checking the text in the first column against a user-specified search string:
QTreeWidgetItemIterator it(treeWidget);
while (*it) {
if ((*it)->text(0) == itemText)
(*it)->setSelected(true);
++it;
}
It is also possible to filter out certain types of node by passing certain flags 到 constructor of QTreeWidgetItemIterator.
这些标志可以被传递给 QTreeWidgetItemIterator constructor (OR-ed together if more than one is used), so that the iterator will only iterate over items that match the given flags.
| 常量 | 值 |
|---|---|
| QTreeWidgetItemIterator.All | 0x00000000 |
| QTreeWidgetItemIterator.Hidden | 0x00000001 |
| QTreeWidgetItemIterator.NotHidden | 0x00000002 |
| QTreeWidgetItemIterator.Selected | 0x00000004 |
| QTreeWidgetItemIterator.Unselected | 0x00000008 |
| QTreeWidgetItemIterator.Selectable | 0x00000010 |
| QTreeWidgetItemIterator.NotSelectable | 0x00000020 |
| QTreeWidgetItemIterator.DragEnabled | 0x00000040 |
| QTreeWidgetItemIterator.DragDisabled | 0x00000080 |
| QTreeWidgetItemIterator.DropEnabled | 0x00000100 |
| QTreeWidgetItemIterator.DropDisabled | 0x00000200 |
| QTreeWidgetItemIterator.HasChildren | 0x00000400 |
| QTreeWidgetItemIterator.NoChildren | 0x00000800 |
| QTreeWidgetItemIterator.Checked | 0x00001000 |
| QTreeWidgetItemIterator.NotChecked | 0x00002000 |
| QTreeWidgetItemIterator.Enabled | 0x00004000 |
| QTreeWidgetItemIterator.Disabled | 0x00008000 |
| QTreeWidgetItemIterator.Editable | 0x00010000 |
| QTreeWidgetItemIterator.NotEditable | 0x00020000 |
| QTreeWidgetItemIterator.UserFlag | 0x01000000 |
IteratorFlags 类型是 typedef 对于 QFlags <IteratorFlag>. It stores an OR combination of IteratorFlag values.
构造迭代器为相同 QTreeWidget as it . The current iterator item is set to point on the current item of it .
构造迭代器为给定 widget that uses the specified flags to determine which items are found during iteration. The iterator is set to point to the first top-level item contained in the widget, or the next matching item if the top-level item doesn't match the flags.
另请参阅 QTreeWidgetItemIterator.IteratorFlag .
构造迭代器为给定 item that uses the specified flags to determine which items are found during iteration. The iterator is set to point to item , or the next matching item if item doesn't match the flags.
另请参阅 QTreeWidgetItemIterator.IteratorFlag .