Struct rute::auto::size_f::SizeF

source ·
pub struct SizeF<'a> { /* private fields */ }
Expand description

Notice these docs are heavy WIP and not very relevent yet

A size is specified by a width() and a height(). It can be set in the constructor and changed using the setWidth(), setHeight(), or scale() functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using the rwidth() and rheight() functions. Finally, the width and height can be swapped using the transpose() function.

The isValid() function determines if a size is valid. A valid size has both width and height greater than or equal to zero. The isEmpty() function returns true if either of the width and height is less than (or equal to) zero, while the isNull() function returns true only if both the width and the height is zero.

Use the expandedTo() function to retrieve a size which holds the maximum height and width of this size and a given size. Similarly, the boundedTo() function returns a size which holds the minimum height and width of this size and a given size.

The QSizeF class also provides the toSize() function returning a QSize copy of this size, constructed by rounding the width and height to the nearest integers.

QSizeF objects can be streamed as well as compared.

See also: Size PointF RectF

Licence

The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.

Implementations

Returns true if both the width and height are 0.0 (ignoring the sign); otherwise returns false.

See also: [is_valid()] [is_empty()]

Returns true if either of the width and height is less than or equal to 0; otherwise returns false.

See also: [is_null()] [is_valid()]

Returns true if both the width and height is equal to or greater than 0; otherwise returns false.

See also: [is_null()] [is_empty()]

Returns the width.

See also: [height()] [set_width()]

Returns the height.

See also: [width()] [set_height()]

Sets the width to the given width.

See also: [width()] [rwidth()] [set_height()]

Sets the height to the given height.

See also: [height()] [rheight()] [set_width()]

Scales the size to a rectangle with the given width and height, according to the specified mode.

  • If mode is Qt::IgnoreAspectRatio, the size is set to ( width, height).
  • If mode is Qt::KeepAspectRatio, the current size is scaled to a rectangle as large as possible inside ( width, height), preserving the aspect ratio.
  • If mode is Qt::KeepAspectRatioByExpanding, the current size is scaled to a rectangle as small as possible outside ( width, height), preserving the aspect ratio.

Example:

See also: [set_width()] [set_height()] [scaled()]

Overloads Scales the size to a rectangle with the given size, according to the specified mode.

Returns a size scaled to a rectangle with the given width and height, according to the specified mode.

See also: [scale()]

Overloads Returns a size scaled to a rectangle with the given size s, according to the specified mode.

Scales the size to a rectangle with the given width and height, according to the specified mode.

  • If mode is Qt::IgnoreAspectRatio, the size is set to ( width, height).
  • If mode is Qt::KeepAspectRatio, the current size is scaled to a rectangle as large as possible inside ( width, height), preserving the aspect ratio.
  • If mode is Qt::KeepAspectRatioByExpanding, the current size is scaled to a rectangle as small as possible outside ( width, height), preserving the aspect ratio.

Example:

See also: [set_width()] [set_height()] [scaled()]

Overloads Scales the size to a rectangle with the given size, according to the specified mode.

Returns a size scaled to a rectangle with the given width and height, according to the specified mode.

See also: [scale()]

Overloads Returns a size scaled to a rectangle with the given size s, according to the specified mode.

Returns a size scaled to a rectangle with the given width and height, according to the specified mode.

See also: [scale()]

Overloads Returns a size scaled to a rectangle with the given size s, according to the specified mode.

Returns a size scaled to a rectangle with the given width and height, according to the specified mode.

See also: [scale()]

Overloads Returns a size scaled to a rectangle with the given size s, according to the specified mode.

Returns a size holding the maximum width and height of this size and the given otherSize.

See also: [bounded_to()] [scale()]

Returns a size holding the minimum width and height of this size and the given otherSize.

See also: [expanded_to()] [scale()]

Returns a reference to the width.

Using a reference makes it possible to manipulate the width directly. For example:

See also: [rheight()] [set_width()]

Returns a reference to the height.

Using a reference makes it possible to manipulate the height directly. For example:

See also: [rwidth()] [set_height()]

Returns an integer based copy of this size.

Note that the coordinates in the returned size will be rounded to the nearest integer.

See also: [q_size_f()]

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.