QSize Class Reference

[ QtCore module]

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

方法

Special Methods


详细描述

This class can be pickled.

The QSize class defines the size of a two-dimensional object using integer 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 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 size.

QSize objects can be streamed as well as compared.


方法文档编制

QSize.__init__ ( self )

Constructs a size with an invalid width and height (i.e., isValid () returns false).

另请参阅 isValid ().

QSize.__init__ ( self , int  w , int  h )

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

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

QSize.__init__ ( self , QSize )

QSize QSize.boundedTo ( self , QSize   otherSize )

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

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

QSize QSize.expandedTo ( self , QSize   otherSize )

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

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

int QSize.height ( self )

返回高度。

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

bool QSize.isEmpty ( self )

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

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

bool QSize.isNull ( self )

Returns true if both the width and height is 0; otherwise returns false.

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

bool QSize.isValid ( self )

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

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

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

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

范例:

 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)
			

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

QSize.scale ( self , int  w , int  h , Qt.AspectRatioMode   mode )

这是重载函数。

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

QSize.setHeight ( self , int  h )

Sets the height to the given height .

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

QSize.setWidth ( self , int  w )

Sets the width to the given width .

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

QSize.transpose ( self )

Swaps the width and height values.

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

int QSize.width ( self )

返回宽度。

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

QSize QSize.__add__ ( self , QSize   s2 )

int QSize.__bool__ ( self )

QSize QSize.__div__ ( self , float  c )

bool QSize.__eq__ ( self , QSize   s2 )

QSize QSize.__iadd__ ( self , QSize   s )

QSize QSize.__idiv__ ( self , float  c )

QSize QSize.__imul__ ( self , float  c )

QSize QSize.__isub__ ( self , QSize   s )

QSize QSize.__mul__ ( self , float  c )

QSize QSize.__mul__ ( self , QSize   s )

bool QSize.__ne__ ( self , QSize   s2 )

str QSize.__repr__ ( self )

QSize QSize.__sub__ ( self , QSize   s2 )