[−][src]Struct qt_core::QSize
The QSize class defines the size of a two-dimensional object using integer point precision.
C++ class: QSize
.
The QSize class defines the size of a two-dimensional object using integer 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.
QSize objects can be streamed as well as compared.
Methods
impl QSize
[src]
pub unsafe fn bounded_to(
&self,
arg1: impl CastInto<Ref<QSize>>
) -> CppBox<QSize>
[src]
&self,
arg1: impl CastInto<Ref<QSize>>
) -> CppBox<QSize>
Returns a size holding the minimum width and height of this size and the given otherSize.
Calls C++ function: QSize QSize::boundedTo(const QSize& arg1) const
.
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<QSize>>
) -> MutRef<QSize>
[src]
&mut self,
other: impl CastInto<Ref<QSize>>
) -> MutRef<QSize>
The QSize class defines the size of a two-dimensional object using integer point precision.
Calls C++ function: QSize& QSize::operator=(const QSize& other)
.
The QSize class defines the size of a two-dimensional object using integer 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.
QSize objects can be streamed as well as compared.
pub unsafe fn expanded_to(
&self,
arg1: impl CastInto<Ref<QSize>>
) -> CppBox<QSize>
[src]
&self,
arg1: impl CastInto<Ref<QSize>>
) -> CppBox<QSize>
Returns a size holding the maximum width and height of this size and the given otherSize.
Calls C++ function: QSize QSize::expandedTo(const QSize& arg1) const
.
pub unsafe fn grown_by(&self, m: impl CastInto<Ref<QMargins>>) -> CppBox<QSize>
[src]
Calls C++ function: QSize QSize::grownBy(QMargins m) const
.
This item is available if cpp_lib_version="5.14.0"
.
pub unsafe fn height(&self) -> c_int
[src]
Returns the height.
Calls C++ function: int QSize::height() const
.
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 QSize::isEmpty() const
.
pub unsafe fn is_null(&self) -> bool
[src]
Returns true
if both the width and height is 0; otherwise returns false.
Calls C++ function: bool QSize::isNull() const
.
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 QSize::isValid() const
.
pub unsafe fn new_0a() -> CppBox<QSize>
[src]
Constructs a size with an invalid width and height (i.e., isValid() returns false
).
Calls C++ function: [constructor] void QSize::QSize()
.
pub unsafe fn new_2a(w: c_int, h: c_int) -> CppBox<QSize>
[src]
Constructs a size with the given width and height.
Calls C++ function: [constructor] void QSize::QSize(int w, int h)
.
pub unsafe fn new_copy(other: impl CastInto<Ref<QSize>>) -> CppBox<QSize>
[src]
The QSize class defines the size of a two-dimensional object using integer point precision.
Calls C++ function: [constructor] void QSize::QSize(const QSize& other)
.
The QSize class defines the size of a two-dimensional object using integer 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.
QSize objects can be streamed as well as compared.
pub unsafe fn rheight(&mut self) -> MutRef<c_int>
[src]
Returns a reference to the height.
Calls C++ function: int& QSize::rheight()
.
pub unsafe fn rwidth(&mut self) -> MutRef<c_int>
[src]
Returns a reference to the width.
Calls C++ function: int& QSize::rwidth()
.
pub unsafe fn scale_3a(&mut self, w: c_int, h: c_int, mode: AspectRatioMode)
[src]
Scales the size to a rectangle with the given width and height, according to the specified mode:
Calls C++ function: void QSize::scale(int w, int h, Qt::AspectRatioMode 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:
QSize t1(10, 12); t1.scale(60, 60, Qt::IgnoreAspectRatio); // t1 is (60, 60)
QSize t2(10, 12); t2.scale(60, 60, Qt::KeepAspectRatio); // t2 is (50, 60)
QSize t3(10, 12); t3.scale(60, 60, Qt::KeepAspectRatioByExpanding); // t3 is (60, 72)
pub unsafe fn scale_2a(
&mut self,
s: impl CastInto<Ref<QSize>>,
mode: AspectRatioMode
)
[src]
&mut self,
s: impl CastInto<Ref<QSize>>,
mode: AspectRatioMode
)
This is an overloaded function.
Calls C++ function: void QSize::scale(const QSize& s, Qt::AspectRatioMode mode)
.
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_int,
h: c_int,
mode: AspectRatioMode
) -> CppBox<QSize>
[src]
&self,
w: c_int,
h: c_int,
mode: AspectRatioMode
) -> CppBox<QSize>
Return a size scaled to a rectangle with the given width and height, according to the specified mode.
Calls C++ function: QSize QSize::scaled(int w, int h, Qt::AspectRatioMode mode) const
.
Return 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<QSize>>,
mode: AspectRatioMode
) -> CppBox<QSize>
[src]
&self,
s: impl CastInto<Ref<QSize>>,
mode: AspectRatioMode
) -> CppBox<QSize>
This is an overloaded function.
Calls C++ function: QSize QSize::scaled(const QSize& s, Qt::AspectRatioMode mode) const
.
This is an overloaded function.
Return 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_int)
[src]
Sets the height to the given height.
Calls C++ function: void QSize::setHeight(int h)
.
pub unsafe fn set_width(&mut self, w: c_int)
[src]
Sets the width to the given width.
Calls C++ function: void QSize::setWidth(int w)
.
pub unsafe fn shrunk_by(&self, m: impl CastInto<Ref<QMargins>>) -> CppBox<QSize>
[src]
Calls C++ function: QSize QSize::shrunkBy(QMargins m) const
.
This item is available if cpp_lib_version="5.14.0"
.
pub unsafe fn transpose(&mut self)
[src]
Swaps the width and height values.
Calls C++ function: void QSize::transpose()
.
Swaps the width and height values.
See also setWidth(), setHeight(), and transposed().
pub unsafe fn transposed(&self) -> CppBox<QSize>
[src]
Returns a QSize with width and height swapped.
Calls C++ function: QSize QSize::transposed() const
.
pub unsafe fn width(&self) -> c_int
[src]
Returns the width.
Calls C++ function: int QSize::width() const
.
Trait Implementations
impl<'_> Add<Ref<QSize>> for &'_ QSize
[src]
type Output = CppBox<QSize>
The resulting type after applying the +
operator.
fn add(self, s2: Ref<QSize>) -> CppBox<QSize>
[src]
Calls C++ function: QSize operator+(const QSize& s1, const QSize& s2)
.
impl AddAssign<Ref<QSize>> for QSize
[src]
fn add_assign(&mut self, arg1: Ref<QSize>)
[src]
Adds the given size to this size, and returns a reference to this size. For example:
Calls C++ function: QSize& QSize::operator+=(const QSize& arg1)
.
impl CppDeletable for QSize
[src]
unsafe fn delete(&mut self)
[src]
The QSize class defines the size of a two-dimensional object using integer point precision.
Calls C++ function: [destructor] void QSize::~QSize()
.
The QSize class defines the size of a two-dimensional object using integer 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.
QSize objects can be streamed as well as compared.
impl<'_> Div<f64> for &'_ QSize
[src]
type Output = CppBox<QSize>
The resulting type after applying the /
operator.
fn div(self, c: c_double) -> CppBox<QSize>
[src]
Calls C++ function: QSize operator/(const QSize& s, double c)
.
impl DivAssign<f64> for QSize
[src]
fn div_assign(&mut self, c: c_double)
[src]
This is an overloaded function.
Calls C++ function: QSize& QSize::operator/=(double c)
.
This is an overloaded function.
Divides both the width and height by the given divisor, and returns a reference to the size.
Note that the result is rounded to the nearest integer.
See also QSize::scale().
impl<'_> Mul<f64> for &'_ QSize
[src]
type Output = CppBox<QSize>
The resulting type after applying the *
operator.
fn mul(self, c: c_double) -> CppBox<QSize>
[src]
Calls C++ function: QSize operator*(const QSize& s, double c)
.
impl MulAssign<f64> for QSize
[src]
fn mul_assign(&mut self, c: c_double)
[src]
This is an overloaded function.
Calls C++ function: QSize& QSize::operator*=(double c)
.
This is an overloaded function.
Multiplies both the width and height by the given factor, and returns a reference to the size.
Note that the result is rounded to the nearest integer.
See also scale().
impl PartialEq<Ref<QSize>> for QSize
[src]
fn eq(&self, s2: &Ref<QSize>) -> bool
[src]
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(const QSize& s1, const QSize& 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
.
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> Sub<Ref<QSize>> for &'_ QSize
[src]
type Output = CppBox<QSize>
The resulting type after applying the -
operator.
fn sub(self, s2: Ref<QSize>) -> CppBox<QSize>
[src]
Calls C++ function: QSize operator-(const QSize& s1, const QSize& s2)
.
impl SubAssign<Ref<QSize>> for QSize
[src]
fn sub_assign(&mut self, arg1: Ref<QSize>)
[src]
Subtracts the given size from this size, and returns a reference to this size. For example:
Calls C++ function: QSize& QSize::operator-=(const QSize& arg1)
.
Auto Trait Implementations
impl RefUnwindSafe for QSize
impl Send for QSize
impl Sync for QSize
impl Unpin for QSize
impl UnwindSafe for QSize
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
unsafe fn static_upcast_mut(ptr: MutPtr<T>) -> MutPtr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,