Hi,
I have problems with itemChange. I use it like the example "Diagram Scene".
I have two ellipse and a line between them and if I move the ellipse the line should move too.
ellipseitem.cpp
QVariant EllipseItem
::itemChange(GraphicsItemChange change,
const QVariant &value
) {
{
foreach (LineItem *arrow, arrows)
{
arrow->updatePosition();
}
}
return value;
}
QVariant EllipseItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == QGraphicsItem::ItemPositionChange)
{
foreach (LineItem *arrow, arrows)
{
arrow->updatePosition();
}
}
return value;
}
To copy to clipboard, switch view to plain text mode
ellipseitem.h
...
protected:
private:
QList<LineItem *> arrows;
...
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
QList<LineItem *> arrows;
To copy to clipboard, switch view to plain text mode
but I get
LineItem was not declared in this scope
C++ forbids declaration of arrows with no type
My LineItem is like this: LineItem(qreal x1, qreal y1, qreal x2, qreal y2);
Can somebody tell me whats wrong?
Bookmarks