Now I've tried this:
graphicsscene.cpp
{
pos=e->scenePos();
EllipseItem *item = new EllipseItem(pos.x()-5, pos.y()-5,10,10);
addItem(item);
if(item->isSelected())
else
}
void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *e)
{
pos=e->scenePos();
EllipseItem *item = new EllipseItem(pos.x()-5, pos.y()-5,10,10);
item->setFlag(QGraphicsItem::ItemIsSelectable);
addItem(item);
if(item->isSelected())
{ item->setFlag(QGraphicsItem::ItemIsMovable, false); }
else
{ item->setFlag(QGraphicsItem::ItemIsMovable, true); }
}
To copy to clipboard, switch view to plain text mode
but it doesn't work too....Can you tell me why?
It seems that the scene ignore item->setFlag(QGraphicsItem::ItemIsMovable, false).
Bookmarks