Squish/Enumerating all Objects Matching a Pattern

From Qt Wiki
< Squish
Revision as of 14:59, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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:

Categories: