QGraphicsItem的shape和boundingRect方法
virtual QRectF boundingRect() const = 0;
virtual QPainterPath shape() const;
boundingRect为纯虚函数,必须重写,shape为虚函数
boundingRect控制QGraphicsItem的边界
shape控制QGraphicsItem的形状,点击该shape即可选中QGraphicsItem
QPainterPathStroker可用于改变QPainterPath的外观,尤其是用来控制路径的描边(stroke)宽度、形状和其他属性
QPainterPathStroker ps;
ps.setWidth(5);
QPainterPath path1;
QPainterPath path = ps.createStroke(path1);//将path1的宽度调整为5
通过QPainterPathStroker和shape方法可以使QGraphicsItem更容易被选中