ellipse->setPos(X,Y) gives me an error.
Solved
General and Desktop
-
I had it working last week, but then I changed something and now I get:
invalid use of incomplete type ‘class QGraphicsEllipseItem’ ellipse->setPos(X,Y); ^
In the contstructor:
scene = new QGraphicsScene(this); ui->graphicsView_1->setScene(scene); QBrush greenBrush(Qt::green); QBrush yellowBrush(Qt::yellow); QBrush redBrush(Qt::red); QBrush greyBrush(Qt::gray); QPen outlinePen(Qt::black); outlinePen.setWidth(0); rectangle = scene->addRect(0, 0, 140, 140, outlinePen, redBrush); rectangle = scene->addRect(40, 40, 100, 100, outlinePen, greenBrush); rectangle = scene->addRect(60, 60, 80, 80, outlinePen, greyBrush); ellipse = scene->addEllipse(50, 50, 10, 10, outlinePen, yellowBrush);
And header file:
QGraphicsScene *scene; QGraphicsRectItem *rectangle; QGraphicsEllipseItem *ellipse; QGraphicsLineItem *horizontalLine, *verticalLine; QGraphicsView *graphicsView_1;
It are 3 colored rectangled with a yellow dot in the middle. The dot gets drawn but I need it to move around when a machine sends data. I am trying to use the setPos() function but that gives the error.
What am I doing wrong