标签: qt qt4 contextmenu qgraphicsview
如何在右键单击QGraphicsView时在Qt中显示弹出菜单?请帮忙
答案 0 :(得分:1)
QGraphicsView源自QWidget,因此只需重新实现contextMenuEvent(QContextMenuEvent* event)即可生成QMenu。如果您想在右侧点击视图中的QGraphicsItems 时显示,则必须在项目中重新实现contextMenuEvent(QGraphicsSceneContextMenuEvent* event)。
QGraphicsView
QWidget
contextMenuEvent(QContextMenuEvent* event)
QMenu
QGraphicsItems
contextMenuEvent(QGraphicsSceneContextMenuEvent* event)