Hi again,
Is all of this actually needed? I found on the internet (for example http://www.qtcentre.org/threads/9342-QGraphicsItem-itemIsMovable) that the movable flag should do the trick. So i removed all handlers from my scene and so on. The Point class now looks like:
@
InterpolationPoint::InterpolationPoint(const MsVector& ref) : pos(ref), iD(i++), hpos(2,1) {
setAcceptedMouseButtons(Qt::LeftButton);
setCursor(Qt::OpenHandCursor);
setFlag(QGraphicsItem::ItemIsMovable, true);
}
InterpolationPoint::~InterpolationPoint() {
}
QRectF InterpolationPoint::boundingRect() const
{
return QRectF(-5, -5, 10, 10);
}
void InterpolationPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
painter->setPen(QPen(Qt::black, 1));
painter->setBrush(Qt::SolidPattern);
painter->drawEllipse(-2, -2, 4, 4);
setPos(QPointFVec(pos));
}
@
Moving the itemismovable into the paint didn't fix the problem for me, I can not move the point across the scene which is basically all I want: movable points, they do not need to drop a shadow or whatever, just movable. How can I achieve this?