[][src]Struct qt_widgets::QSizePolicy

#[repr(C)]pub struct QSizePolicy { /* fields omitted */ }

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

C++ class: QSizePolicy.

C++ documentation:

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific widget by changing its QWidget::sizePolicy property.

QSizePolicy contains two independent QSizePolicy::Policy values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the setHorizontalPolicy() and setVerticalPolicy() functions. The stretch factors can be set using the setHorizontalStretch() and setVerticalStretch() functions. The flag indicating whether the widget's sizeHint() is width-dependent (such as a menu bar or a word-wrapping label) can be set using the setHeightForWidth() function.

The current size policies and stretch factors be retrieved using the horizontalPolicy(), verticalPolicy(), horizontalStretch() and verticalStretch() functions. Alternatively, use the transpose() function to swap the horizontal and vertical policies and stretches. The hasHeightForWidth() function returns the current status of the flag indicating the size hint dependencies.

Use the expandingDirections() function to determine whether the associated widget can make use of more space than its sizeHint() function indicates, as well as find out in which directions it can expand.

Finally, the QSizePolicy class provides operators comparing this size policy to a given policy, as well as a QVariant operator storing this QSizePolicy as a QVariant object.

Methods

impl QSizePolicy[src]

pub unsafe fn control_type(&self) -> ControlType[src]

Returns the control type associated with the widget for which this size policy applies.

Calls C++ function: QSizePolicy::ControlType QSizePolicy::controlType() const.

C++ documentation:

Returns the control type associated with the widget for which this size policy applies.

This function was introduced in Qt 4.3.

See also setControlType().

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QSizePolicy>>
) -> Ref<QSizePolicy>
[src]

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

Calls C++ function: QSizePolicy& QSizePolicy::operator=(const QSizePolicy& other).

C++ documentation:

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific widget by changing its QWidget::sizePolicy property.

QSizePolicy contains two independent QSizePolicy::Policy values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the setHorizontalPolicy() and setVerticalPolicy() functions. The stretch factors can be set using the setHorizontalStretch() and setVerticalStretch() functions. The flag indicating whether the widget's sizeHint() is width-dependent (such as a menu bar or a word-wrapping label) can be set using the setHeightForWidth() function.

The current size policies and stretch factors be retrieved using the horizontalPolicy(), verticalPolicy(), horizontalStretch() and verticalStretch() functions. Alternatively, use the transpose() function to swap the horizontal and vertical policies and stretches. The hasHeightForWidth() function returns the current status of the flag indicating the size hint dependencies.

Use the expandingDirections() function to determine whether the associated widget can make use of more space than its sizeHint() function indicates, as well as find out in which directions it can expand.

Finally, the QSizePolicy class provides operators comparing this size policy to a given policy, as well as a QVariant operator storing this QSizePolicy as a QVariant object.

pub unsafe fn expanding_directions(&self) -> QFlags<Orientation>[src]

Returns whether a widget can make use of more space than the QWidget::sizeHint() function indicates.

Calls C++ function: QFlags<Qt::Orientation> QSizePolicy::expandingDirections() const.

C++ documentation:

Returns whether a widget can make use of more space than the QWidget::sizeHint() function indicates.

A value of Qt::Horizontal or Qt::Vertical means that the widget can grow horizontally or vertically (i.e., the horizontal or vertical policy is Expanding or MinimumExpanding), whereas Qt::Horizontal | Qt::Vertical means that it can grow in both dimensions.

See also horizontalPolicy() and verticalPolicy().

pub unsafe fn has_height_for_width(&self) -> bool[src]

Returns true if the widget's preferred height depends on its width; otherwise returns false.

Calls C++ function: bool QSizePolicy::hasHeightForWidth() const.

C++ documentation:

Returns true if the widget's preferred height depends on its width; otherwise returns false.

See also setHeightForWidth().

pub unsafe fn has_width_for_height(&self) -> bool[src]

Returns true if the widget's width depends on its height; otherwise returns false.

Calls C++ function: bool QSizePolicy::hasWidthForHeight() const.

C++ documentation:

Returns true if the widget's width depends on its height; otherwise returns false.

See also setWidthForHeight().

pub unsafe fn horizontal_policy(&self) -> Policy[src]

Returns the horizontal component of the size policy.

Calls C++ function: QSizePolicy::Policy QSizePolicy::horizontalPolicy() const.

C++ documentation:

Returns the horizontal component of the size policy.

See also setHorizontalPolicy(), verticalPolicy(), and horizontalStretch().

pub unsafe fn horizontal_stretch(&self) -> c_int[src]

Returns the horizontal stretch factor of the size policy.

Calls C++ function: int QSizePolicy::horizontalStretch() const.

C++ documentation:

Returns the horizontal stretch factor of the size policy.

See also setHorizontalStretch(), verticalStretch(), and horizontalPolicy().

pub unsafe fn new_0a() -> CppBox<QSizePolicy>[src]

Constructs a QSizePolicy object with Fixed as its horizontal and vertical policies.

Calls C++ function: [constructor] void QSizePolicy::QSizePolicy().

C++ documentation:

Constructs a QSizePolicy object with Fixed as its horizontal and vertical policies.

The policies can be altered using the setHorizontalPolicy() and setVerticalPolicy() functions. Use the setHeightForWidth() function if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).

See also setHorizontalStretch() and setVerticalStretch().

pub unsafe fn new_3a(
    horizontal: Policy,
    vertical: Policy,
    type_: ControlType
) -> CppBox<QSizePolicy>
[src]

Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.

Calls C++ function: [constructor] void QSizePolicy::QSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical, QSizePolicy::ControlType type = …).

C++ documentation:

Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.

Use setHeightForWidth() if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).

This function was introduced in Qt 4.3.

See also setHorizontalStretch(), setVerticalStretch(), and controlType().

pub unsafe fn new_2a(
    horizontal: Policy,
    vertical: Policy
) -> CppBox<QSizePolicy>
[src]

Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.

Calls C++ function: [constructor] void QSizePolicy::QSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical).

C++ documentation:

Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.

Use setHeightForWidth() if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).

This function was introduced in Qt 4.3.

See also setHorizontalStretch(), setVerticalStretch(), and controlType().

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QSizePolicy>>
) -> CppBox<QSizePolicy>
[src]

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

Calls C++ function: [constructor] void QSizePolicy::QSizePolicy(const QSizePolicy& other).

C++ documentation:

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific widget by changing its QWidget::sizePolicy property.

QSizePolicy contains two independent QSizePolicy::Policy values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the setHorizontalPolicy() and setVerticalPolicy() functions. The stretch factors can be set using the setHorizontalStretch() and setVerticalStretch() functions. The flag indicating whether the widget's sizeHint() is width-dependent (such as a menu bar or a word-wrapping label) can be set using the setHeightForWidth() function.

The current size policies and stretch factors be retrieved using the horizontalPolicy(), verticalPolicy(), horizontalStretch() and verticalStretch() functions. Alternatively, use the transpose() function to swap the horizontal and vertical policies and stretches. The hasHeightForWidth() function returns the current status of the flag indicating the size hint dependencies.

Use the expandingDirections() function to determine whether the associated widget can make use of more space than its sizeHint() function indicates, as well as find out in which directions it can expand.

Finally, the QSizePolicy class provides operators comparing this size policy to a given policy, as well as a QVariant operator storing this QSizePolicy as a QVariant object.

pub unsafe fn retain_size_when_hidden(&self) -> bool[src]

Returns whether the layout should retain the widget's size when it is hidden. This is false by default.

Calls C++ function: bool QSizePolicy::retainSizeWhenHidden() const.

C++ documentation:

Returns whether the layout should retain the widget's size when it is hidden. This is false by default.

This function was introduced in Qt 5.2.

See also setRetainSizeWhenHidden().

pub unsafe fn set_control_type(&self, type_: ControlType)[src]

Sets the control type associated with the widget for which this size policy applies to type.

Calls C++ function: void QSizePolicy::setControlType(QSizePolicy::ControlType type).

C++ documentation:

Sets the control type associated with the widget for which this size policy applies to type.

The control type specifies the type of the widget for which this size policy applies. It is used by some styles, notably QMacStyle, to insert proper spacing between widgets. For example, the macOS Aqua guidelines specify that push buttons should be separated by 12 pixels, whereas vertically stacked radio buttons only require 6 pixels.

This function was introduced in Qt 4.3.

See also controlType() and QStyle::layoutSpacing().

pub unsafe fn set_height_for_width(&self, b: bool)[src]

Sets the flag determining whether the widget's preferred height depends on its width, to dependent.

Calls C++ function: void QSizePolicy::setHeightForWidth(bool b).

C++ documentation:

Sets the flag determining whether the widget's preferred height depends on its width, to dependent.

See also hasHeightForWidth() and setWidthForHeight().

pub unsafe fn set_horizontal_policy(&self, d: Policy)[src]

Sets the horizontal component to the given policy.

Calls C++ function: void QSizePolicy::setHorizontalPolicy(QSizePolicy::Policy d).

C++ documentation:

Sets the horizontal component to the given policy.

See also horizontalPolicy(), setVerticalPolicy(), and setHorizontalStretch().

pub unsafe fn set_horizontal_stretch(&self, stretch_factor: c_int)[src]

Sets the horizontal stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].

Calls C++ function: void QSizePolicy::setHorizontalStretch(int stretchFactor).

C++ documentation:

Sets the horizontal stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].

When two widgets are adjacent to each other in a horizontal layout, setting the horizontal stretch factor of the widget on the left to 2 and the factor of widget on the right to 1 will ensure that the widget on the left will always be twice the size of the one on the right.

See also horizontalStretch(), setVerticalStretch(), and setHorizontalPolicy().

pub unsafe fn set_retain_size_when_hidden(&self, retain_size: bool)[src]

Sets whether a layout should retain the widget's size when it is hidden. If retainSize is true, the layout will not be changed by hiding the widget.

Calls C++ function: void QSizePolicy::setRetainSizeWhenHidden(bool retainSize).

C++ documentation:

Sets whether a layout should retain the widget's size when it is hidden. If retainSize is true, the layout will not be changed by hiding the widget.

This function was introduced in Qt 5.2.

See also retainSizeWhenHidden().

pub unsafe fn set_vertical_policy(&self, d: Policy)[src]

Sets the vertical component to the given policy.

Calls C++ function: void QSizePolicy::setVerticalPolicy(QSizePolicy::Policy d).

C++ documentation:

Sets the vertical component to the given policy.

See also verticalPolicy(), setHorizontalPolicy(), and setVerticalStretch().

pub unsafe fn set_vertical_stretch(&self, stretch_factor: c_int)[src]

Sets the vertical stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].

Calls C++ function: void QSizePolicy::setVerticalStretch(int stretchFactor).

C++ documentation:

Sets the vertical stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].

When two widgets are adjacent to each other in a vertical layout, setting the vertical stretch factor of the widget on the top to 2 and the factor of widget on the bottom to 1 will ensure that the widget on the top will always be twice the size of the one on the bottom.

See also verticalStretch(), setHorizontalStretch(), and setVerticalPolicy().

pub unsafe fn set_width_for_height(&self, b: bool)[src]

Sets the flag determining whether the widget's width depends on its height, to dependent.

Calls C++ function: void QSizePolicy::setWidthForHeight(bool b).

C++ documentation:

Sets the flag determining whether the widget's width depends on its height, to dependent.

This is only supported for QGraphicsLayout's subclasses. It is not possible to have a layout with both height-for-width and width-for-height constraints at the same time.

See also hasWidthForHeight() and setHeightForWidth().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>[src]

Returns a QVariant storing this QSizePolicy.

Calls C++ function: QVariant QSizePolicy::operator QVariant() const.

C++ documentation:

Returns a QVariant storing this QSizePolicy.

pub unsafe fn transpose(&self)[src]

Swaps the horizontal and vertical policies and stretches.

Calls C++ function: void QSizePolicy::transpose().

C++ documentation:

Swaps the horizontal and vertical policies and stretches.

See also transposed().

pub unsafe fn transposed(&self) -> CppBox<QSizePolicy>[src]

Returns a size policy object with the horizontal and vertical policies and stretches swapped.

Calls C++ function: QSizePolicy QSizePolicy::transposed() const.

C++ documentation:

Returns a size policy object with the horizontal and vertical policies and stretches swapped.

This function was introduced in Qt 5.9.

See also transpose().

pub unsafe fn vertical_policy(&self) -> Policy[src]

Returns the vertical component of the size policy.

Calls C++ function: QSizePolicy::Policy QSizePolicy::verticalPolicy() const.

C++ documentation:

Returns the vertical component of the size policy.

See also setVerticalPolicy(), horizontalPolicy(), and verticalStretch().

pub unsafe fn vertical_stretch(&self) -> c_int[src]

Returns the vertical stretch factor of the size policy.

Calls C++ function: int QSizePolicy::verticalStretch() const.

C++ documentation:

Returns the vertical stretch factor of the size policy.

See also setVerticalStretch(), horizontalStretch(), and verticalPolicy().

Trait Implementations

impl CppDeletable for QSizePolicy[src]

unsafe fn delete(&self)[src]

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

Calls C++ function: [destructor] void QSizePolicy::~QSizePolicy().

C++ documentation:

The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific widget by changing its QWidget::sizePolicy property.

QSizePolicy contains two independent QSizePolicy::Policy values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the setHorizontalPolicy() and setVerticalPolicy() functions. The stretch factors can be set using the setHorizontalStretch() and setVerticalStretch() functions. The flag indicating whether the widget's sizeHint() is width-dependent (such as a menu bar or a word-wrapping label) can be set using the setHeightForWidth() function.

The current size policies and stretch factors be retrieved using the horizontalPolicy(), verticalPolicy(), horizontalStretch() and verticalStretch() functions. Alternatively, use the transpose() function to swap the horizontal and vertical policies and stretches. The hasHeightForWidth() function returns the current status of the flag indicating the size hint dependencies.

Use the expandingDirections() function to determine whether the associated widget can make use of more space than its sizeHint() function indicates, as well as find out in which directions it can expand.

Finally, the QSizePolicy class provides operators comparing this size policy to a given policy, as well as a QVariant operator storing this QSizePolicy as a QVariant object.

impl PartialEq<Ref<QSizePolicy>> for QSizePolicy[src]

fn eq(&self, s: &Ref<QSizePolicy>) -> bool[src]

Returns true if this policy is equal to other; otherwise returns false.

Calls C++ function: bool QSizePolicy::operator==(const QSizePolicy& s) const.

C++ documentation:

Returns true if this policy is equal to other; otherwise returns false.

See also operator!=().

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.