geometry: The current position and size of the widget inside the parent. For example, a widget with geometry (10, 20, 50, 70) will be located at position (10, 20) inside the parent with a width of 50 and a height of 70.
sizeHint: (perhaps what you are referring to is "hintSize"). The preferred size in which the widget will be. Override this method to change it.
size policy . How the widget will respond when it is placed in a container with dimensions other than its own. Size policies are a combination of:
- [
QSizePolicy::Maximum ] can a widget shrink below sizeHint - [
QSizePolicy::Minimum ] whether the widget can expand over its sizeHint and - [
QSizePolicy::Expanding ] whether the widget should expand to fill extra space.
Widgets have both horizontal and vertical size policies.
However, you are probably looking for layouts that automatically resize widgets for your parents based on these rules. For example, for a widget to populate a parent element, set the parent layout to QVBoxLayout , and then add the child widget to the layout. When the parent size is resized, the file size will be resized automatically.
source share