QSize Class Reference

[QtCore module]

该QSIZE类定义使用整数点位精度二维物体的大小。More…

Methods

  • __init__ (self)
  • __init__ (self, int w, int h)
  • __init__ (self, QSize)
  • QSize boundedTo (self, QSize otherSize)
  • QSize expandedTo (self, QSize otherSize)
  • int height (self)
  • bool isEmpty (self)
  • bool isNull (self)
  • bool isValid (self)
  • scale (self, QSize s, Qt.AspectRatioMode mode)
  • scale (self, int w, int h, Qt.AspectRatioMode mode)
  • setHeight (self, int h)
  • setWidth (self, int w)
  • transpose (self)
  • int width (self)

Special Methods

  • QSize __add__ (self, QSize s2)
  • int __bool__ (self)
  • QSize __div__ (self, float c)
  • bool __eq__ (self, QSize s2)
  • QSize __iadd__ (self, QSize s)
  • QSize __idiv__ (self, float c)
  • QSize __imul__ (self, float c)
  • QSize __isub__ (self, QSize s)
  • QSize __mul__ (self, float c)
  • QSize __mul__ (self, QSize s)
  • bool __ne__ (self, QSize s2)
  • str __repr__ (self)
  • QSize __sub__ (self, QSize s2)

Detailed Description

这个类可以醃制。

该QSIZE类定义使用整数点位精度二维物体的大小。

大小是由一个指定的width()和一个height( ) 。它可以在构造函数中设置和使用改变了setWidth( )setHeight() ,或scale( )函数,或者使用算术运算符。阿尺寸也可以通过使用检索引用的宽度和高度直接操作rwidth()和rheight()函数。最后,将宽度和高度可以使用被交换的transpose()函数。

isValid( )函数确定的尺寸是有效的(有效尺寸有宽度和高度大于零) 。该isEmpty()函数返回真,如果任一宽度和高度是小于或等于,大于零,而isNull只有当二者的宽度和高度是零()函数返回真。

使用expandedTo()函数来检索一个大小而持有的最大高度和宽度this尺寸和给定的尺寸。类似地,boundedTo( )函数返回一个大小持有的最小高度和宽度this尺寸和给定的尺寸。

相比QSIZE对象可以被串流播放以及。


Method Documentation

  1. QSize.__init__ (self)

构造一个大小与一个无效的宽度和高度(即isValid( )返回False ) 。

See also isValid( ) 。

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

构造一个大小与给定widthheight

See also setWidth()和setHeight( ) 。

  1. QSize.__init__ (self, QSize)
  1. QSize QSize.boundedTo (self, QSize otherSize)

[

返回一个大小保持这个大小的最小宽度和高度与给定的otherSize

]($docs-qsize.html)

See also expandedTo()和scale( ) 。

  1. QSize QSize.expandedTo (self, QSize otherSize)

[

返回一个大小保持这个大小的最大宽度和高度与给定的otherSize

]($docs-qsize.html)

See also boundedTo()和scale( ) 。

  1. int QSize.height (self)

返回的高度。

See also width()和setHeight( ) 。

  1. bool QSize.isEmpty (self)

返回True ,如果不是的宽度和高度小于或等于0 ,否则返回False 。

See also isNull()和isValid( ) 。

  1. bool QSize.isNull (self)

返回True如果宽度和高度为0 ,否则返回False 。

See also isValid()和isEmpty( ) 。

  1. bool QSize.isValid (self)

返回True,如果两者的宽度和高度是等于或大于0 ,否则返回假。

See also isNull()和isEmpty( ) 。

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

缩放大小的矩形与给定的widthheight,根据指定的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.

例如:

  1. [QSize]($docs-qsize.html) t1(10, 12);
  2. t1.scale(60, 60, [Qt](qt.html).IgnoreAspectRatio);
  3. // t1 is (60, 60)
  4. [QSize]($docs-qsize.html) t2(10, 12);
  5. t2.scale(60, 60, [Qt](qt.html).KeepAspectRatio);
  6. // t2 is (50, 60)
  7. [QSize]($docs-qsize.html) t3(10, 12);
  8. t3.scale(60, 60, [Qt](qt.html).KeepAspectRatioByExpanding);
  9. // t3 is (60, 72)

See also setWidth()和setHeight( ) 。

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

这是一个重载函数。

缩放大小的矩形与给定的size,根据指定的mode

  1. QSize.setHeight (self, int h)

设置高度为给定的height

See also rheight( )height()和setWidth( ) 。

  1. QSize.setWidth (self, int w)

设置宽度为给定的width

See also rwidth( )width()和setHeight( ) 。

  1. QSize.transpose (self)

交换的宽度和高度的值。

See also setWidth()和setHeight( ) 。

  1. int QSize.width (self)

返回的宽度。

See also height()和setWidth( ) 。

  1. QSize QSize.__add__ (self, QSize s2)

[

  1. int QSize.__bool__ (self)

]($docs-qsize.html)

  1. QSize QSize.__div__ (self, float c)

[

  1. bool QSize.__eq__ (self, QSize s2)

]($docs-qsize.html)

  1. QSize QSize.__iadd__ (self, QSize s)

  1. QSize QSize.__idiv__ (self, float c)

  1. QSize QSize.__imul__ (self, float c)

  1. QSize QSize.__isub__ (self, QSize s)

  1. QSize QSize.__mul__ (self, float c)

  1. QSize QSize.__mul__ (self, QSize s)

[

  1. bool QSize.__ne__ (self, QSize s2)
  1. str QSize.__repr__ (self)

]($docs-qsize.html)

  1. QSize QSize.__sub__ (self, QSize s2)