Home · All Classes · Modules |
The QSizeF class defines the size of a two-dimensional object using floating point precision. More...
This class can be pickled.
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.
Constructs an invalid size.
See also isValid().
Constructs a size with floating point accuracy from the given size.
See also toSize().
Constructs a size with the given width and height.
Returns a size holding the minimum width and height of this size and the given otherSize.
See also expandedTo() and scale().
Returns a size holding the maximum width and height of this size and the given otherSize.
See also boundedTo() and scale().
Returns the height.
See also width() and setHeight().
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
See also isNull() and isValid().
Returns true if both the width and height are +0.0; otherwise returns false.
Note: Since this function treats +0.0 and -0.0 differently, sizes with zero width and height where either or both values have a negative sign are not defined to be null sizes.
See also isValid() and isEmpty().
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
See also isNull() and isEmpty().
Scales the size to a rectangle with the given width and height, according to the specified mode.
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() and setHeight().
This is an overloaded function.
Scales the size to a rectangle with the given size, according to the specified mode.
Sets the height to the given height.
See also height(), rheight(), and setWidth().
Sets the width to the given width.
See also width(), rwidth(), and setHeight().
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().
Swaps the width and height values.
See also setWidth() and setHeight().
Returns the width.
See also height() and setWidth().
PyQt 4.9.4 for Windows | Copyright © Riverbank Computing Ltd and Nokia 2012 | Qt 4.8.2 |