QGraphicsRectItem露
The
QGraphicsRectItemclass provides a rectangle item that you can add to aQGraphicsScene. More鈥�

Synopsis露
Functions露
Detailed Description露
To set the item鈥檚 rectangle, pass a
QRectFtoQGraphicsRectItem鈥榮 constructor, or call thesetRect()function. Therect()function returns the current rectangle.![]()
QGraphicsRectItemuses the rectangle and the pen width to provide a reasonable implementation ofboundingRect(),shape(), andcontains(). Thepaint()function draws the rectangle using the item鈥檚 associated pen and brush, which you can set by calling thesetPen()andsetBrush()functions.Note
The rendering of invalid rectangles, such as those with negative widths or heights, is undefined. If you cannot be sure that you are using valid rectangles (for example, if you are creating rectangles using data from an unreliable source) then you should use
normalized()to create normalized rectangles, and use those instead.
- class PySide2.QtWidgets.QGraphicsRectItem([parent=None])露
PySide2.QtWidgets.QGraphicsRectItem(rect[, parent=None])
PySide2.QtWidgets.QGraphicsRectItem(x, y, w, h[, parent=None])
- param w:
float
- param parent:
- param x:
float
- param y:
float
- param h:
float
- param rect:
Constructs a
QGraphicsRectItem.parentis passed toQAbstractGraphicsShapeItem鈥榮 constructor.See also
Constructs a
QGraphicsRectItem, usingrectas the default rectangle.parentis passed toQAbstractGraphicsShapeItem鈥榮 constructor.See also
Constructs a
QGraphicsRectItemwith a default rectangle defined by (x,y) and the givenwidthandheight.parentis passed toQAbstractGraphicsShapeItem鈥榮 constructor.See also
- PySide2.QtWidgets.QGraphicsRectItem.rect()露
- Return type:
Returns the item鈥檚 rectangle.
See also
- PySide2.QtWidgets.QGraphicsRectItem.setRect(rect)露
- Parameters:
rect 鈥�
PySide2.QtCore.QRectF
Sets the item鈥檚 rectangle to be the given
rectangle.See also
- PySide2.QtWidgets.QGraphicsRectItem.setRect(x, y, w, h)
- Parameters:
x 鈥� float
y 鈥� float
w 鈥� float
h 鈥� float
漏 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.