Hi!
I want clone selected item at QGraphicsScene if user start moving item with pressed Alt.
I wrote this code:
Qt Code:
  1. if(mouseEvent->modifiers() == Qt::AltModifier)
  2. {
  3. QList<QGraphicsItem *> itList = this->selectedItems();
  4. if(itList.size()==1)
  5. {
  6. DiagramElement *de = (DiagramElement*)itList[0];
  7. DiagramElement *declone = de->clone();
  8.  
  9. de->setSelected(false);
  10.  
  11. declone->setPos(mouseEvent->scenePos());
  12. this->addItem(declone);
  13.  
  14. declone->setSelected(true);
  15. }
  16. QGraphicsScene::mouseMoveEvent(mouseEvent);
  17. }
To copy to clipboard, switch view to plain text mode 

This code is in class-child of QGraphicsScene. DiagramElement is child of QGraphicsItem.
After cloning old and new items are selected and moving together.
Old item is to stay in place and not be selected.