Hi,
You need to work with void myScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent). mouseEvent will be in scene coordinates and itemAt(mouseEvent->scenePos()) will return an item in that position if any.
To handle the right click in the node you can use void contextMenuEvent(QGraphicsSceneContextMenuEvent *event). For example:
{
event->accept(); //Accept the event.
QMenu menu;
//Create a meny menu.addAction(myaction); //Add an action
menu.exec(event->screenPos()); //Shows the menu in the screen position.
}
void myitem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
event->accept(); //Accept the event.
QMenu menu; //Create a meny
menu.addAction(myaction); //Add an action
menu.exec(event->screenPos()); //Shows the menu in the screen position.
}
To copy to clipboard, switch view to plain text mode
As for the unavailable synchoneous data I have no idea. In which procedure of your code you call scene->items() ?
Carlos.
Bookmarks