QSize

Inheritance diagram of QSize

Synopsis

Functions

def __add__ (,s2)
def __div__ (,c)
def __eq__ (,s2)
def __iadd__ (arg__1)
def __idiv__ (c)
def __imul__ (c)
def __isub__ (arg__1)
def __mul__ (,c)
def __mul__ (c)
def __ne__ (,s2)
def __sub__ (,s2)
def boundedTo (arg__1)
def expandedTo (arg__1)
def height ()
def isEmpty ()
def isNull ()
def isValid ()
def scale (s,mode)
def scale (w,h,mode)
def setHeight (h)
def setWidth (w)
def transpose ()
def width ()

Detailed Description

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

A size is specified by a QSize.width() and a QSize.height() . It can be set in the constructor and changed using the QSize.setWidth() , QSize.setHeight() , or QSize.scale() functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using the QSize.rwidth() and QSize.rheight() functions. Finally, the width and height can be swapped using the QSize.transpose() function.

The QSize.isValid() function determines if a size is valid (a valid size has both width and height greater than zero). The QSize.isEmpty() function returns true if either of the width and height is less than, or equal to, zero, while the QSize.isNull() function returns true only if both the width and the height is zero.

Use the QSize.expandedTo() function to retrieve a size which holds the maximum height and width of this size and a given size. Similarly, the QSize.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.

See also

QSizeF QPoint QRect

class PySide.QtCore.QSize(QSize)
class PySide.QtCore.QSize
class PySide.QtCore.QSize(w, h)
Parameters:
  • w – int
  • h – int
  • QSize – QSize

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

See also

QSize.isValid()

Constructs a size with the given width and height .

QSize.boundedTo(arg__1)
Parameter:arg__1 – QSize
Return type:QSize

Returns a size holding the minimum width and height of this size and the given otherSize .

QSize.expandedTo(arg__1)
Parameter:arg__1 – QSize
Return type:QSize

Returns a size holding the maximum width and height of this size and the given otherSize .

QSize.height()
Return type:int

Returns the height.

QSize.isEmpty()
Return type:bool

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

QSize.isNull()
Return type:bool

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

QSize.isValid()
Return type:bool

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

QSize.__ne__(s2)
Parameter:s2 – QSize
Return type:bool
QSize.__mul__(c)
Parameter:c – qreal
Return type:QSize
QSize.__mul__(c)
Parameter:c – qreal
Return type:QSize
QSize.__imul__(c)
Parameter:c – qreal
Return type:QSize

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

QSize.scale()

QSize.__add__(s2)
Parameter:s2 – QSize
Return type:QSize
QSize.__iadd__(arg__1)
Parameter:arg__1 – QSize
Return type:QSize

Adds the given size to this size, and returns a reference to this size. For example:

s = QSize( 3, 7)
r = QSize(-1, 4)
s += r

# s becomes (2,11)
QSize.__sub__(s2)
Parameter:s2 – QSize
Return type:QSize
QSize.__isub__(arg__1)
Parameter:arg__1 – QSize
Return type:QSize

Subtracts the given size from this size, and returns a reference to this size. For example:

s = QSize( 3, 7)
r = QSize(-1, 4)
s -= r

# s becomes (4,3)
QSize.__div__(c)
Parameter:c – qreal
Return type:QSize
QSize.__idiv__(c)
Parameter:c – qreal
Return type:QSize

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()

QSize.__eq__(s2)
Parameter:s2 – QSize
Return type:bool
QSize.scale(s, mode)
Parameters:
  • s – QSize
  • mode – AspectRatioMode
QSize.scale(w, h, mode)
Parameters:
  • w – int
  • h – int
  • mode – AspectRatioMode
QSize.setHeight(h)
Parameter:h – int

Sets the height to the given height .

See also

QSize.rheight() QSize.height() QSize.setWidth()

QSize.setWidth(w)
Parameter:w – int

Sets the width to the given width .

See also

QSize.rwidth() QSize.width() QSize.setHeight()

QSize.transpose()

Swaps the width and height values.

QSize.width()
Return type:int

Returns the width.