void BxLevelScene::mousePressEvent(QGraphicsSceneMouseEvent* event) { if(event->button() != Qt::LeftButton) return; switch (mMode) { case insertItem: { BxActorItem* newItem = new BxActorItem(); BxIntAttribute* radiusAttr = new BxIntAttribute("radius", 5); newItem->addAttribute(radiusAttr); newItem->setPos(event->scenePos()); insertActor(newItem); setMode(moveItem); } break; default: ; } QGraphicsScene::mousePressEvent(event); }
Actor* ActorBank::createActor(const Location& location, float radius) { Actor* actor = new Actor(location, radius); insertActor(*actor); return actor; }