QSizeF Class Reference

[ QtCore module]

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

方法

Special Methods


详细描述

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 () 和 height (). It can be set in the constructor and changed using the setWidth (), setHeight (),或 scale () functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using the rwidth () 和 rheight () functions. Finally, the width and height can be swapped using the transpose () 函数。

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.

使用 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 尺寸。

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.


方法文档编制

QSizeF.__init__ ( self )

Constructs an invalid size.

另请参阅 isValid ().

QSizeF.__init__ ( self , QSize   sz )

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

另请参阅 toSize ().

QSizeF.__init__ ( self , float  w , float  h )

构造尺寸,采用给定 width and height .

QSizeF.__init__ ( self , QSizeF )

QSizeF QSizeF.boundedTo ( self , QSizeF   otherSize )

Returns a size holding the minimum width and height of this size 和给定 otherSize .

另请参阅 expandedTo () 和 scale ().

QSizeF QSizeF.expandedTo ( self , QSizeF   otherSize )

Returns a size holding the maximum width and height of this size 和给定 otherSize .

另请参阅 boundedTo () and scale ().

float QSizeF.height ( self )

返回高度。

另请参阅 width () 和 setHeight ().

bool QSizeF.isEmpty ( self )

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

另请参阅 isNull () 和 isValid ().

bool QSizeF.isNull ( self )

Returns true if both the width and height are +0.0; otherwise returns false.

注意: 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.

另请参阅 isValid () 和 isEmpty ().

bool QSizeF.isValid ( self )

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

另请参阅 isNull () 和 isEmpty ().

QSizeF.scale ( self , QSizeF   s , Qt.AspectRatioMode   mode )

把尺寸缩放到矩形,采用给定 width and height ,根据指定 mode .

范例:

 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)
			

另请参阅 setWidth () and setHeight ().

QSizeF.scale ( self , float  w , float  h , Qt.AspectRatioMode   mode )

这是重载函数。

把尺寸缩放到矩形,采用给定 size , according to the specified mode .

QSizeF.setHeight ( self , float  h )

Sets the height to the given height .

另请参阅 height (), rheight (),和 setWidth ().

QSizeF.setWidth ( self , float  w )

Sets the width to the given width .

另请参阅 width (), rwidth (),和 setHeight ().

QSize QSizeF.toSize ( self )

Returns an integer based copy of this size.

Note that the coordinates in the returned size will be rounded 到最近整数。

另请参阅 QSizeF ().

QSizeF.transpose ( self )

Swaps the width and height values.

另请参阅 setWidth () and setHeight ().

float QSizeF.width ( self )

返回宽度。

另请参阅 height () 和 setWidth ().

QSizeF QSizeF.__add__ ( self , QSizeF   s2 )

int QSizeF.__bool__ ( self )

QSizeF QSizeF.__div__ ( self , float  c )

bool QSizeF.__eq__ ( self , QSizeF   s2 )

QSizeF QSizeF.__iadd__ ( self , QSizeF   s )

QSizeF QSizeF.__idiv__ ( self , float  c )

QSizeF QSizeF.__imul__ ( self , float  c )

QSizeF QSizeF.__isub__ ( self , QSizeF   s )

QSizeF QSizeF.__mul__ ( self , float  c )

QSizeF QSizeF.__mul__ ( self , QSizeF   s )

bool QSizeF.__ne__ ( self , QSizeF   s2 )

str QSizeF.__repr__ ( self )

QSizeF QSizeF.__sub__ ( self , QSizeF   s2 )