Skip to main content

LensStudio:Ui.SizePolicy.Policy

Enum

Enum defining how a widget resizes along an axis: Fixed, Minimum, MinimumExpanding, Maximum, Preferred, Expanding, or Ignored.

Index

Example

// SizePolicy.Policy controls how a widget's size behaves within a layout.
// Use widget.setSizePolicy(horizontal, vertical) to configure both axes.
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
root.layout = layout;

const fixedLabel = new Label(root);
fixedLabel.text = 'Fixed height label';
fixedLabel.setSizePolicy(SizePolicy.Policy.Preferred, SizePolicy.Policy.Fixed);
layout.addWidget(fixedLabel);

const expandingLabel = new Label(root);
expandingLabel.text = 'Expanding label fills remaining space';
expandingLabel.setSizePolicy(SizePolicy.Policy.Expanding, SizePolicy.Policy.Expanding);
layout.addWidget(expandingLabel);

Enumeration Members

Expanding

Expanding: number

Widget actively takes as much space as available.


Fixed

Fixed: number

Widget size is fixed and will not grow or shrink.


Ignored

Ignored: number

Widget size hint is ignored and it takes all available space.


Maximum

Maximum: number

Widget can shrink but prefers its size hint as maximum.


Minimum

Minimum: number

Widget can grow but prefers its minimum size hint.


MinimumExpanding

MinimumExpanding: number

Widget can grow and will expand if extra space is available, but prefers its minimum size hint.


Preferred

Preferred: number

Widget uses its size hint as preferred size and can grow or shrink.