【发布时间】:2011-10-18 01:41:33
【问题描述】:
我有一个 QGraphicsScene,我想在上面画一些特殊的曲线。为此,我创建了一个类,在其中我将这些特殊曲线定义为新的 QGraphicsItem:
#include < QGraphicsItem> 类 Clothoid:公共 QGraphicsItem { 民众: Clothoid(QPoint startPoint, QPoint endPoint); 虚拟〜Clothoid(); QPoint 点; QPoint ePoint; 浮动开始曲率; 浮动结束曲率; 浮动回旋线长度; 受保护: QRectF boundingRect() 常量; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); };我尝试将每个项目插入两次:一次在我定义的数组中:
QList 回旋曲线;在场景中一次:
void renderArea::updateClothoid(const QPoint &p1, const QPoint &p2) { Clothoid *temp = new Clothoid(p1, p2); clothoids.append(&temp); 场景->addItem(&temp); }但是我得到了这两个错误:
没有匹配函数调用'QList::append(Clothoid**)'
和
没有匹配函数调用'QGraphicsScene::addItem(Clothoid**)'
我做错了什么?
【问题讨论】:
标签: qt4 qlist qgraphicsscene