当前支持常见的图元类型包含: QGraphicsRectItem # 矩形 QGraphicsTextItem # 文字 QGraphicsLineItem # 线段 QGraphicsPathItem
addPath函数返回一个指向新创建的QGraphicsPathItem实例的指针。 addSimpleText和addText函数可用于将纯文本和带格式的文本添加到场景中。 以下是这些子类,在前面的示例中已经直接或间接使用了这些子类: QGraphicsEllipseItem QGraphicsLineItem QGraphicsPathItem QGraphicsPixmapItem boundingRegion(transform); QPainterPath painterPath; painterPath.addRegion(region); QGraphicsPathItem *path = new QGraphicsPathItem(painterPath); scene.addItem(path); 在前面的代码中,如果将g替换为0.0,0.1,0.75