Hi,
I have a QGraphicsScene on which I would like to draw some special curves. I made a class in which I define these special curves as a new QGraphicsItem:
{
public:
virtual ~Clothoid();
...
protected:
};
class Clothoid : public QGraphicsItem
{
public:
Clothoid(QPoint startPoint, QPoint endPoint);
virtual ~Clothoid();
...
protected:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
};
To copy to clipboard, switch view to plain text mode
and I try to insert each item twice: once in an array I defined:
QList<Clothoid *> clothoids;
QList<Clothoid *> clothoids;
To copy to clipboard, switch view to plain text mode
and once in the scene:
void renderArea
::updateClothoid(const QPoint &p1,
const QPoint &p2
) {
Clothoid *temp = new Clothoid(p1, p2);
clothoids.append(&temp);
scene->addItem(&temp);
}
void renderArea::updateClothoid(const QPoint &p1, const QPoint &p2)
{
Clothoid *temp = new Clothoid(p1, p2);
clothoids.append(&temp);
scene->addItem(&temp);
}
To copy to clipboard, switch view to plain text mode
But I get these 2 errors:
no matching function for call to 'QList<Clothoid*>::append(Clothoid**)'
and
no matching function for call to 'QGraphicsScene::addItem(Clothoid**)'
What am I doing wrong?
Bookmarks