有没有办法在 Qt 中修改 QGraphicsPathItem 的路径?
我以这种方式创建了项目:
QGraphicsPathItem* item = new QGraphicsPathItem();
QPainterPath* path = new QPainterPath();
path->cubicTo(3,5, 3,10, 0,15);
item->setPath(*path);
item->moveBy(-20,-20);
scene->addItem(item);
现在我想修改路径的元素:
item->path().elementAt(0).y = -5;
item->path().elementAt(0).x = 0;
但我收到以下错误:
assignment of member 'QPainterPath::Element::y' in read-only object