void CustomItem::contextMenuEvent(QGraph icsSceneContextMenuEvent *event){QMenu menu;QAction *removeAction = menu.addAction("Remove");QAction *markAction = menu.addAction("Mark");QAction *selectedAction = menu.exec(event->screenPos());if ( selectedAction == removeAction ) { //...} else if ( selectedAction == markAction ) { //...}}
Object::connect: No such slot QGraphicsObject::slotmessage() in graphika_rect.cpp:30
C++ (Qt)void Graphika_rect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ QMenu menu; QAction *removeAction = menu.addAction(tr("Создать итем")); QAction *markAction = menu.addAction(tr("Для сцены 2")); connect(&menu,SIGNAL(triggered(QAction*)),SLOT(slotmessage())); menu.exec(event->screenPos());}