[][src]Struct qt_core::QSizeF

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

The QSizeF class defines the size of a two-dimensional object using floating point precision.

C++ class: QSizeF.

C++ documentation:

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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.

Methods

impl QSizeF[src]

pub unsafe fn bounded_to(
    &self,
    arg1: impl CastInto<Ref<QSizeF>>
) -> CppBox<QSizeF>
[src]

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

Calls C++ function: QSizeF QSizeF::boundedTo(const QSizeF& arg1) const.

C++ documentation:

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

See also expandedTo() and scale().

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

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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

C++ documentation:

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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.

pub unsafe fn expanded_to(
    &self,
    arg1: impl CastInto<Ref<QSizeF>>
) -> CppBox<QSizeF>
[src]

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

Calls C++ function: QSizeF QSizeF::expandedTo(const QSizeF& arg1) const.

C++ documentation:

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

See also boundedTo() and scale().

pub unsafe fn height(&self) -> c_double[src]

Returns the height.

Calls C++ function: double QSizeF::height() const.

C++ documentation:

Returns the height.

See also width() and setHeight().

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

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

Calls C++ function: bool QSizeF::isEmpty() const.

C++ documentation:

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

See also isNull() and isValid().

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

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

Calls C++ function: bool QSizeF::isNull() const.

C++ documentation:

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

See also isValid() and isEmpty().

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

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

Calls C++ function: bool QSizeF::isValid() const.

C++ documentation:

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

See also isNull() and isEmpty().

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

Constructs an invalid size.

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

C++ documentation:

Constructs an invalid size.

See also isValid().

pub unsafe fn new_1a(sz: impl CastInto<Ref<QSize>>) -> CppBox<QSizeF>[src]

Constructs a size with floating point accuracy from the given size.

Calls C++ function: [constructor] void QSizeF::QSizeF(const QSize& sz).

C++ documentation:

Constructs a size with floating point accuracy from the given size.

See also toSize().

pub unsafe fn new_2a(w: c_double, h: c_double) -> CppBox<QSizeF>[src]

Constructs a size with the given width and height.

Calls C++ function: [constructor] void QSizeF::QSizeF(double w, double h).

C++ documentation:

Constructs a size with the given width and height.

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

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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

C++ documentation:

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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.

pub unsafe fn rheight(&mut self) -> MutRef<c_double>[src]

Returns a reference to the height.

Calls C++ function: double& QSizeF::rheight().

C++ documentation:

Returns a reference to the height.

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

QSizeF size(100, 10.2); size.rheight() += 5.5;

// size becomes (100,15.7)

See also rwidth() and setHeight().

pub unsafe fn rwidth(&mut self) -> MutRef<c_double>[src]

Returns a reference to the width.

Calls C++ function: double& QSizeF::rwidth().

C++ documentation:

Returns a reference to the width.

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

QSizeF size(100.3, 10); size.rwidth() += 20.5;

// size becomes (120.8,10)

See also rheight() and setWidth().

pub unsafe fn scale_3a(
    &mut self,
    w: c_double,
    h: c_double,
    mode: AspectRatioMode
)
[src]

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

Calls C++ function: void QSizeF::scale(double w, double h, Qt::AspectRatioMode mode).

C++ documentation:

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:

QSizeF t1(10, 12); t1.scale(60, 60, Qt::IgnoreAspectRatio); // t1 is (60, 60)

QSizeF t2(10, 12); t2.scale(60, 60, Qt::KeepAspectRatio); // t2 is (50, 60)

QSizeF t3(10, 12); t3.scale(60, 60, Qt::KeepAspectRatioByExpanding); // t3 is (60, 72)

See also setWidth(), setHeight(), and scaled().

pub unsafe fn scale_2a(
    &mut self,
    s: impl CastInto<Ref<QSizeF>>,
    mode: AspectRatioMode
)
[src]

This is an overloaded function.

Calls C++ function: void QSizeF::scale(const QSizeF& s, Qt::AspectRatioMode mode).

C++ documentation:

This is an overloaded function.

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

pub unsafe fn scaled_3a(
    &self,
    w: c_double,
    h: c_double,
    mode: AspectRatioMode
) -> CppBox<QSizeF>
[src]

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

Calls C++ function: QSizeF QSizeF::scaled(double w, double h, Qt::AspectRatioMode mode) const.

C++ documentation:

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

This function was introduced in Qt 5.0.

See also scale().

pub unsafe fn scaled_2a(
    &self,
    s: impl CastInto<Ref<QSizeF>>,
    mode: AspectRatioMode
) -> CppBox<QSizeF>
[src]

This is an overloaded function.

Calls C++ function: QSizeF QSizeF::scaled(const QSizeF& s, Qt::AspectRatioMode mode) const.

C++ documentation:

This is an overloaded function.

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

This function was introduced in Qt 5.0.

pub unsafe fn set_height(&mut self, h: c_double)[src]

Sets the height to the given height.

Calls C++ function: void QSizeF::setHeight(double h).

C++ documentation:

Sets the height to the given height.

See also height(), rheight(), and setWidth().

pub unsafe fn set_width(&mut self, w: c_double)[src]

Sets the width to the given width.

Calls C++ function: void QSizeF::setWidth(double w).

C++ documentation:

Sets the width to the given width.

See also width(), rwidth(), and setHeight().

pub unsafe fn to_size(&self) -> CppBox<QSize>[src]

Returns an integer based copy of this size.

Calls C++ function: QSize QSizeF::toSize() const.

C++ documentation:

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 QSizeF().

pub unsafe fn transpose(&mut self)[src]

Swaps the width and height values.

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

C++ documentation:

Swaps the width and height values.

See also setWidth(), setHeight(), and transposed().

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

Returns the size with width and height values swapped.

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

C++ documentation:

Returns the size with width and height values swapped.

This function was introduced in Qt 5.0.

See also transpose().

pub unsafe fn width(&self) -> c_double[src]

Returns the width.

Calls C++ function: double QSizeF::width() const.

C++ documentation:

Returns the width.

See also height() and setWidth().

Trait Implementations

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

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

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(const QSizeF& s1, const QSizeF& s2).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2):

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

impl<'_> Div<f64> for &'_ QSizeF[src]

type Output = CppBox<QSizeF>

The resulting type after applying the / operator.

fn div(self, c: c_double) -> CppBox<QSizeF>[src]

Calls C++ function: QSizeF operator/(const QSizeF& s, double c).

impl<'_> Sub<Ref<QSizeF>> for &'_ QSizeF[src]

type Output = CppBox<QSizeF>

The resulting type after applying the - operator.

fn sub(self, s2: Ref<QSizeF>) -> CppBox<QSizeF>[src]

Calls C++ function: QSizeF operator-(const QSizeF& s1, const QSizeF& s2).

impl<'_> Add<Ref<QSizeF>> for &'_ QSizeF[src]

type Output = CppBox<QSizeF>

The resulting type after applying the + operator.

fn add(self, s2: Ref<QSizeF>) -> CppBox<QSizeF>[src]

Calls C++ function: QSizeF operator+(const QSizeF& s1, const QSizeF& s2).

impl<'_> Mul<f64> for &'_ QSizeF[src]

type Output = CppBox<QSizeF>

The resulting type after applying the * operator.

fn mul(self, c: c_double) -> CppBox<QSizeF>[src]

Calls C++ function: QSizeF operator*(const QSizeF& s, double c).

impl AddAssign<Ref<QSizeF>> for QSizeF[src]

fn add_assign(&mut self, arg1: Ref<QSizeF>)[src]

Adds the given size to this size and returns a reference to this size. For example:

Calls C++ function: QSizeF& QSizeF::operator+=(const QSizeF& arg1).

C++ documentation:

Adds the given size to this size and returns a reference to this size. For example:


  QSizeF s( 3, 7);
  QSizeF r(-1, 4);
  s += r;

  // s becomes (2,11)

impl SubAssign<Ref<QSizeF>> for QSizeF[src]

fn sub_assign(&mut self, arg1: Ref<QSizeF>)[src]

Subtracts the given size from this size and returns a reference to this size. For example:

Calls C++ function: QSizeF& QSizeF::operator-=(const QSizeF& arg1).

C++ documentation:

Subtracts the given size from this size and returns a reference to this size. For example:


  QSizeF s( 3, 7);
  QSizeF r(-1, 4);
  s -= r;

  // s becomes (4,3)

impl MulAssign<f64> for QSizeF[src]

fn mul_assign(&mut self, c: c_double)[src]

This is an overloaded function.

Calls C++ function: QSizeF& QSizeF::operator*=(double c).

C++ documentation:

This is an overloaded function.

Multiplies both the width and height by the given factor and returns a reference to the size.

See also scale().

impl DivAssign<f64> for QSizeF[src]

fn div_assign(&mut self, c: c_double)[src]

This is an overloaded function.

Calls C++ function: QSizeF& QSizeF::operator/=(double c).

C++ documentation:

This is an overloaded function.

Divides both the width and height by the given divisor and returns a reference to the size.

See also scale().

impl CppDeletable for QSizeF[src]

unsafe fn delete(&mut self)[src]

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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

C++ documentation:

The QSizeF class defines the size of a two-dimensional object using floating point precision.

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.

Auto Trait Implementations

impl Send for QSizeF

impl Sync for QSizeF

impl Unpin for QSizeF

impl UnwindSafe for QSizeF

impl RefUnwindSafe for QSizeF

Blanket Implementations

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

impl<T> From<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.

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

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

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

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

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