QGraphicsSceneContextMenuEvent Class

The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework. More...

Header: #include <QGraphicsSceneContextMenuEvent>
qmake: QT += widgets
Since: Qt 4.2
Inherits: QGraphicsSceneEvent

This class was introduced in Qt 4.2.

Public Types

enum Reason { Mouse, Keyboard, Other }

Detailed Description

A QContextMenuEvent received by a QGraphicsView is translated into a QGraphicsSceneContextMenuEvent. The QContextMenuEvent::globalPos() is translated into item, scene, and screen coordinates (pos(), scenePos(), and screenPos()).

See also QGraphicsSceneMouseEvent, QGraphicsSceneWheelEvent, and QContextMenuEvent.

Member Type Documentation

enum QGraphicsSceneContextMenuEvent::Reason

This enum describes the reason why the context event was sent.

ConstantValueDescription
QGraphicsSceneContextMenuEvent::Mouse0The mouse caused the event to be sent. On most platforms, this means the right mouse button was clicked.
QGraphicsSceneContextMenuEvent::Keyboard1The keyboard caused this event to be sent. On Windows and macOS, this means the menu button was pressed.
QGraphicsSceneContextMenuEvent::Other2The event was sent by some other means (i.e. not by the mouse or keyboard).