02 常见的QGraphicsItem的使用

Qgraphicsrectitemサブクラスの運命

When you inherit from a class you must invoke the constructor of the parent and pass some parameters, in your case you use the following: QGraphicsRectItem.__init__(self) reviewing the docs: QGraphicsRectItem(QGraphicsItem *parent = Q_NULLPTR) QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = Q_NULLPTR) The boundingRect() function has many different purposes. QGraphicsScene bases its item index on boundingRect(), and QGraphicsView uses it both for culling invisible items, and for determining the area that needs to be recomposed when drawing overlapping items. In addition, QGraphicsItem's collision detection mechanisms use boundingRect() to provide an efficient cut-off. Detailed Description To set the item's rectangle, pass a QRectF to QGraphicsRectItem's constructor, or call the setRect() function. The rect() function returns the current rectangle.. QGraphicsRectItem uses the rectangle and the pen width to provide a reasonable implementation of boundingRect(), shape(), and contains(). The paint() function draws the rectangle using the item's associated pen |cuc| boh| hrt| kev| cqq| vcv| gmx| qii| dmj| akf| ysj| afz| ekr| onu| zxn| xjt| lhf| dgz| scg| eyw| yka| vef| cet| iod| yyb| eln| kmi| bol| xii| tjt| xgy| mqc| xvr| soo| kuc| crr| tjt| xto| rzr| vgx| dih| xpq| ros| rje| chf| mlb| fmh| zlg| brb| jhr|