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
__reduce__
()
def
__repr__
()
def
__sub__
(, s2)
def
boundedTo
(arg__1)
def
expandedTo
(arg__1)
def
grownBy
(m)
def
height
()
def
isEmpty
()
def
isNull
()
def
isValid
()
def
scale
(s, mode)
def
scale
(w, h, mode)
def
scaled
(s, mode)
def
scaled
(w, h, mode)
def
setHeight
(h)
def
setWidth
(w)
def
shrunkBy
(m)
def
toSize
()
def
toTuple
()
def
transpose
()
def
transposed
()
def
width
()
A size is specified by a
width()和height(). It can be set in the constructor and changed using thesetWidth(),setHeight(),或scale()functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using therwidth()andrheight()functions. Finally, the width and height can be swapped using thetranspose()函数。
isValid()function determines if a size is valid. A valid size has both width and height greater than or equal to zero. TheisEmpty()function returnstrueif either of the width and height is less than (or equal to) zero, while theisNull()function returnstrueonly 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, theboundedTo()function returns a size which holds the minimum height and width of this size and a given size.
QSizeFclass also provides thetoSize()function returning aQSizecopy of this size, constructed by rounding the width and height to the nearest integers.
QSizeFobjects can be streamed as well as compared.
QSizeF
¶
Constructs an invalid size.
另请参阅
Constructs a size with floating point accuracy from the given
size
.
另请参阅
构造尺寸,采用给定
width
and
height
.
PySide2.QtCore.QSizeF.
__reduce__
(
)
¶
PyObject
PySide2.QtCore.QSizeF.
__repr__
(
)
¶
PyObject
PySide2.QtCore.QSizeF.
boundedTo
(
arg__1
)
¶
返回尺寸,该尺寸保持最小宽度 高度,及给定
otherSize
.
另请参阅
PySide2.QtCore.QSizeF.
expandedTo
(
arg__1
)
¶
Returns a size holding the maximum width and height of this size and the given
otherSize
.
另请参阅
PySide2.QtCore.QSizeF.
height
(
)
¶
qreal
返回高度。
另请参阅
PySide2.QtCore.QSizeF.
isEmpty
(
)
¶
bool
返回
true
若宽度和高度两者任一 <= 0;否则返回
false
.
PySide2.QtCore.QSizeF.
isNull
(
)
¶
bool
返回
true
若宽度和高度两者为 0.0 (忽略正负号);否则返回
false
.
PySide2.QtCore.QSizeF.
isValid
(
)
¶
bool
返回
true
若宽度和高度两者 >= 0;否则返回
false
.
PySide2.QtCore.QSizeF.
__imul__
(
c
)
¶
c
–
qreal
这是重载函数。
Multiplies both the width and height by the given
factor
and returns a reference to the size.
另请参阅
PySide2.QtCore.QSizeF.
__iadd__
(
arg__1
)
¶
添加给定
size
to this size and returns a reference to this size. For example:
s = QSizeF( 3, 7)
r = QSizeF(-1, 4)
s += r
# s becomes (2,11)
PySide2.QtCore.QSizeF.
__isub__
(
arg__1
)
¶
Subtracts the given
size
from this size and returns a reference to this size. For example:
s = QSizeF( 3, 7)
r = QSizeF(-1, 4)
s -= r
# s becomes (4,3)
PySide2.QtCore.QSizeF.
__idiv__
(
c
)
¶
c
–
qreal
这是重载函数。
Divides both the width and height by the given
divisor
and returns a reference to the size.
另请参阅
PySide2.QtCore.QSizeF.
scale
(
s
,
mode
)
¶
s
–
QSizeF
mode
–
AspectRatioMode
这是重载函数。
把尺寸比例缩放到矩形采用给定
size
,根据指定
mode
.
PySide2.QtCore.QSizeF.
scale
(
w
,
h
,
mode
)
¶
w
–
qreal
h
–
qreal
mode
–
AspectRatioMode
把尺寸比例缩放到矩形采用给定
width
and
height
,根据指定
mode
.
若
mode
is
IgnoreAspectRatio
, the size is set to (
width
,
height
).
若
mode
is
KeepAspectRatio
, the current size is scaled to a rectangle as large as possible inside (
width
,
height
), preserving the aspect ratio.
若
mode
is
KeepAspectRatioByExpanding
, the current size is scaled to a rectangle as small as possible outside (
width
,
height
), preserving the aspect ratio.
范例:
t1 = QSizeF(10, 12)
t1.scale(60, 60, Qt.IgnoreAspectRatio)
# t1 is (60, 60)
t2 = QSizeF(10, 12)
t2.scale(60, 60, Qt.KeepAspectRatio)
# t2 is (50, 60)
t3 = QSizeF(10, 12)
t3.scale(60, 60, Qt.KeepAspectRatioByExpanding)
# t3 is (60, 72)
PySide2.QtCore.QSizeF.
scaled
(
w
,
h
,
mode
)
¶
w
–
qreal
h
–
qreal
mode
–
AspectRatioMode
Returns a size scaled to a rectangle with the given
width
and
height
,根据指定
mode
.
另请参阅
PySide2.QtCore.QSizeF.
scaled
(
s
,
mode
)
¶
这是重载函数。
Returns a size scaled to a rectangle with the given size
s
,根据指定
mode
.
PySide2.QtCore.QSizeF.
setHeight
(
h
)
¶
h
–
qreal
Sets the height to the given
height
.
另请参阅
height()
rheight()
setWidth()
PySide2.QtCore.QSizeF.
setWidth
(
w
)
¶
w
–
qreal
Sets the width to the given
width
.
另请参阅
width()
rwidth()
setHeight()
PySide2.QtCore.QSizeF.
toSize
(
)
¶
Returns an integer based copy of this size.
Note that the coordinates in the returned size will be rounded to the nearest integer.
另请参阅
QSizeF()
PySide2.QtCore.QSizeF.
toTuple
(
)
¶
PyObject
PySide2.QtCore.QSizeF.
transpose
(
)
¶
Swaps the width and height values.
PySide2.QtCore.QSizeF.
transposed
(
)
¶
Returns the size with width and height values swapped.
另请参阅
PySide2.QtCore.QSizeF.
width
(
)
¶
qreal
返回宽度。
另请参阅