Squish/Enumerating all Objects Matching a Pattern: Difference between revisions
< Squish
Jump to navigation
Jump to search
No edit summary |
(No difference)
|
Revision as of 14:59, 14 January 2015
Enumerating all objects matching a pattern
When using Squish’s pattern lookup functionality, it is often useful to perform an operation on all occurrences of an object matching a Squish pattern. The following function will let you enumerate all occurrences matching a pattern like you would any Python collection:
This function will yield all of the objects matching the specified pattern, by occurrence unless an alternative field to enumerate is provided with ‘%i’ as its value.
As a usage example, to log the contents of all QLabel widgets with parent :foo, you would do: