Squish/Keeping an Object Tree Tidy

From Qt Wiki
Jump to navigation Jump to search

Keep a tidy object tree

Always remember to keep your tree clean by removing old objects from it or adapting the object properties to match the new layout of the application. This will accomplish 2 things: 1)You keep a comprehensive relationship of the objects that do exist in your application rather than a tree with every object the application has ever seen. 2)You will fix your application much easily.

It can be the case that a particular object is particularly hard to predict, perhaps your application title changes with every revision of your application. If so, every build could, potentially, break your Q&A. Instead of trying to manually correct it or compute at run time, you should use the squish built in different modes to match properties. Remember that there exists a wildcard mode:

{title?='SomeApp*' type='QMainWindow'}<code>

and a regular expression mode:

{title~='SomeApp.*' type='QMainWindow'}

This way you can avoid creating too many objects and keep your tree clean.