sizePolicy

The sizePolicy property is a sizing directive to display form elements.

Usage

This property defines how the front-ends will compute the size of some form elements in grids. The sizePolicy applies only to leaf elements, not to containers. The default value of sizePolicy is initial.

The sizePolicy property is ignored for the widgets used in Table and Tree columns, because in tables, the size policy is implicitly defined by the cell as fixed (i.e. the size of the column in the form layout).

When the sizePolicy is fixed, the form elements size is exactly the one defined in the Form Specification File. The size of the element is computed from the width and height in the form grid and the font used on the front-end side.

When sizePolicy is dynamic, the size of the element grows and shrinks according to the width of the wider during the life time of the application. This can be used for ComboBox or RadioGroup fields, when the size of the widget must fit exactly to its content, which can vary during the program execution. With sizePolicy=DYNAMIC, Buttons, Labels, CheckBoxes, Images, and RadioGroups can shrink and grow all the time, while ComboBoxes can only grow.

When sizePolicy is initial, the size is computed the first time the element appears on the screen. Once the widget is displayed, its size is frozen. This is typically used when the size of the element must be fixed but is not known at design time (for instance, when populating a ComboBox item list from a database table). This option is also useful when the text of labels is unknown at design time because of Internationalization. With sizePolicy=initial, the behavior differs depending on the form element type. Keep in mind that after the firs the display, the element size will be frozen:

The sizePolicy property is supported for WebComponent fields, however as the content and behavior is defined by the front-end, this property may have no effect. See the front-end web-component specific documentation for more details.