What is Anchors?
All widgets have them, whenever a parent
container is resized, how the children
are resized can be determined by how they are
anchored to the container.
Let's start with an example, let's say
we wanted to resize a window and we have
a button control in the bottom right corner
of the view. As we resize the window
we would like the button to remain
'anchored' to the bottom right corner. How
would we accomplish this? By anchoring the
bottom and the right anchors.
As you can see from the above example we did not add a minimum size to
the window widget. Lets add one now, setMinimumSize="120,40".
What would happen if the widget is not anchored,
setAnchor="false,false,false,false", this is the default setting
of most Widgets. The behaviour would mean that the widget would try
to maintain its relative postion on the window while it is getting resized.
To illustrate, view the example below
>From the example above we see the button 'M' tries to maintain its position
relative to the sides of the container it sits in. Also it has to be
noted that the widget 'M' slides UNDER the original button.
The rule for z-order is quite simply the top most widgets are
the widgets defined FIRST. Let's flesh out our example by
creating a central widget 'anchored' to all four sides of the container
it sits in.
>From the example above we extended the minimum size to encompass the two buttons,
'ok' and 'cancel' and the larger 'm' widget. Pretty simple so far, let's say we
now wish to add a listbox in the panel (widget 'M'). And we want is anchored
on the left side as well as above and below. Also we could add two buttons to the
right of 'M'.
As you can see from the example above embedded widgets will ALSO get resized based
on the way they are 'anchored' to their parents. The anchors can be applied at all
levels of the widget hierachy. When one widget gets resized, all its children gets
resized while respecting the manner in which they are anchored
Note: The setMaximumSize and the removeItem attributes are part of the 381 build.