![]() |
Qt 6.x
The Qt SDK
|
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework. More...
#include <qgraphicssceneevent.h>
Inheritance diagram for QGraphicsSceneContextMenuEvent:
Collaboration diagram for QGraphicsSceneContextMenuEvent:Public Member Functions | |
| QGraphicsSceneContextMenuEvent (Type type=None) | |
| ~QGraphicsSceneContextMenuEvent () | |
| Destroys the event. | |
| QPointF | pos () const |
| Returns the position of the mouse cursor in item coordinates at the moment the context menu was requested. | |
| void | setPos (const QPointF &pos) |
| QPointF | scenePos () const |
| Returns the position of the mouse cursor in scene coordinates at the moment the context menu was requested. | |
| void | setScenePos (const QPointF &pos) |
| QPoint | screenPos () const |
| Returns the position of the mouse cursor in screen coordinates at the moment the context menu was requested. | |
| void | setScreenPos (const QPoint &pos) |
| Qt::KeyboardModifiers | modifiers () const |
| Returns the keyboard modifiers in use when the context menu was requested. | |
| void | setModifiers (Qt::KeyboardModifiers modifiers) |
| Reason | reason () const |
| Returns the reason for the context menu event. | |
| void | setReason (Reason reason) |
Public Member Functions inherited from QGraphicsSceneEvent | |
| QGraphicsSceneEvent (Type type) | |
| ~QGraphicsSceneEvent () | |
| Destroys the event. | |
| QWidget * | widget () const |
| Returns the widget where the event originated, or \nullptr if the event originates from another application. | |
| void | setWidget (QWidget *widget) |
| quint64 | timestamp () const |
| void | setTimestamp (quint64 ts) |
Public Member Functions inherited from QEvent | |
| QEvent (Type type) | |
| Constructs an event object of type type. | |
| virtual | ~QEvent () |
| Destroys the event. | |
| Type | type () const |
| Returns the event type. | |
| bool | spontaneous () const |
Returns true if the event originated outside the application (a system event); otherwise returns false. | |
| virtual void | setAccepted (bool accepted) |
| bool | isAccepted () const |
| void | accept () |
| Sets the accept flag of the event object, the equivalent of calling setAccepted(true). | |
| void | ignore () |
| Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false). | |
| bool | isInputEvent () const noexcept |
| bool | isPointerEvent () const noexcept |
| bool | isSinglePointEvent () const noexcept |
| virtual QEvent * | clone () const |
| Creates and returns an identical copy of this event. | |
Additional Inherited Members | |
Static Public Member Functions inherited from QEvent | |
| static int | registerEventType (int hint=-1) noexcept |
Protected Member Functions inherited from QGraphicsSceneEvent | |
| QGraphicsSceneEvent (QGraphicsSceneEventPrivate &dd, Type type=None) | |
Protected Member Functions inherited from QEvent | |
| QEvent (Type type, InputEventTag) | |
| QEvent (Type type, PointerEventTag) | |
| QEvent (Type type, SinglePointEventTag) | |
Protected Attributes inherited from QGraphicsSceneEvent | |
| QScopedPointer< QGraphicsSceneEventPrivate > | d_ptr |
Protected Attributes inherited from QEvent | |
| quint16 | t |
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework.
\inmodule QtWidgets
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()).
Definition at line 142 of file qgraphicssceneevent.h.
This enum describes the reason why the context event was sent.
\value Mouse The mouse caused the event to be sent. On most platforms, this means the right mouse button was clicked.
\value Keyboard The keyboard caused this event to be sent. On Windows and \macos, this means the menu button was pressed.
\value Other The event was sent by some other means (i.e. not by the mouse or keyboard).
| Enumerator | |
|---|---|
| Mouse | |
| Keyboard | |
| Other | |
Definition at line 145 of file qgraphicssceneevent.h.
Constructs a graphics scene context menu event of the specified type.
Definition at line 941 of file qgraphicssceneevent.cpp.
| QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent | ( | ) |
Destroys the event.
Definition at line 949 of file qgraphicssceneevent.cpp.
| Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers | ( | ) | const |
Returns the keyboard modifiers in use when the context menu was requested.
Definition at line 1031 of file qgraphicssceneevent.cpp.
References d.
Referenced by operator<<(), and setModifiers().
Here is the caller graph for this function:| QPointF QGraphicsSceneContextMenuEvent::pos | ( | ) | const |
Returns the position of the mouse cursor in item coordinates at the moment the context menu was requested.
Definition at line 959 of file qgraphicssceneevent.cpp.
References d.
Referenced by QWidgetTextControl::processEvent(), QGraphicsItemPrivate::remapItemPos(), setPos(), setScenePos(), and setScreenPos().
Here is the caller graph for this function:| QGraphicsSceneContextMenuEvent::Reason QGraphicsSceneContextMenuEvent::reason | ( | ) | const |
Returns the reason for the context menu event.
Definition at line 1054 of file qgraphicssceneevent.cpp.
References d.
Referenced by operator<<(), and setReason().
Here is the caller graph for this function:| QPointF QGraphicsSceneContextMenuEvent::scenePos | ( | ) | const |
Returns the position of the mouse cursor in scene coordinates at the moment the context menu was requested.
Definition at line 984 of file qgraphicssceneevent.cpp.
References d.
| QPoint QGraphicsSceneContextMenuEvent::screenPos | ( | ) | const |
Returns the position of the mouse cursor in screen coordinates at the moment the context menu was requested.
Definition at line 1009 of file qgraphicssceneevent.cpp.
References d.
Referenced by QWidgetTextControl::processEvent().
Here is the caller graph for this function:| void QGraphicsSceneContextMenuEvent::setModifiers | ( | Qt::KeyboardModifiers | modifiers | ) |
Sets the keyboard modifiers associated with the context menu to the modifiers specified.
Definition at line 1043 of file qgraphicssceneevent.cpp.
References d, and modifiers().
Referenced by QGraphicsView::contextMenuEvent().
Here is the call graph for this function:
Here is the caller graph for this function:Sets the position associated with the context menu to the given point in item coordinates.
Definition at line 972 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsItemPrivate::remapItemPos().
Here is the call graph for this function:
Here is the caller graph for this function:Sets the reason for the context menu event to reason.
Definition at line 1066 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsView::contextMenuEvent().
Here is the call graph for this function:
Here is the caller graph for this function:Sets the position associated with the context menu to the given point in scene coordinates.
Definition at line 997 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsView::contextMenuEvent().
Here is the call graph for this function:
Here is the caller graph for this function:Sets the position associated with the context menu to the given point in screen coordinates.
Definition at line 1022 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsView::contextMenuEvent().
Here is the call graph for this function:
Here is the caller graph for this function: