3 QnstScene::QnstScene(QObject* parent)
4 : QGraphicsScene(parent)
10 QnstScene::~QnstScene()
15 QVector<QnstGraphicsEntity*> QnstScene::getRoots()
const
29 connect(entity, SIGNAL(cutRequested()), SIGNAL(cutRequested()));
30 connect(entity, SIGNAL(copyRequested()), SIGNAL(copyRequested()));
31 connect(entity, SIGNAL(pasteRequested()), SIGNAL(pasteRequested()));
33 connect(entity, SIGNAL(deleteRequested()), SIGNAL(deleteRequested()));
35 connect(entity, SIGNAL(exportRequested()), SIGNAL(exportRequested()));
37 connect(entity, SIGNAL(zoominRequested()), SIGNAL(zoominRequested()));
38 connect(entity, SIGNAL(zoomoutRequested()), SIGNAL(zoomoutRequested()));
39 connect(entity, SIGNAL(zoomresetRequested()), SIGNAL(zoomresetRequested()));
40 connect(entity, SIGNAL(fullscreenRequested()), SIGNAL(fullscreenRequested()));
50 menu->menuInsert->setEnabled(
false);
51 menu->actionAddBody->setEnabled(
false);
59 int index = roots.indexOf(entity);
67 menu->menuInsert->setEnabled(
true);
68 menu->actionAddBody->setEnabled(
true);
73 void QnstScene::createObjects()
76 menu->actionExport->setEnabled(
true);
78 menu->menuInsert->setEnabled(
true);
79 menu->actionAddBody->setEnabled(
true);
82 void QnstScene::createConnections()
84 connect(menu, SIGNAL(exportRequested()), SIGNAL(exportRequested()));
87 connect(menu, SIGNAL(menuAddEntityTriggered(Qnst::EntityType)),
91 void QnstScene::performBody()
94 entity->setTop(height()/2 - DEFAULT_BODY_HEIGHT/2);
95 entity->setLeft(width()/2 - DEFAULT_BODY_WIDTH/2);
96 entity->setWidth(DEFAULT_BODY_WIDTH);
97 entity->setHeight(DEFAULT_BODY_HEIGHT);
101 emit entityAdded(entity);
104 void QnstScene::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
106 QGraphicsScene::contextMenuEvent(event);
108 if (!event->isAccepted())
110 menu->exec(event->screenPos());