![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework. More...
#include <qgraphicssceneevent.h>
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 | |
QT_DEFINE_TAG_STRUCT (InputEventTag) | |
QEvent (Type type, InputEventTag) | |
QT_DEFINE_TAG_STRUCT (PointerEventTag) | |
QEvent (Type type, PointerEventTag) | |
QT_DEFINE_TAG_STRUCT (SinglePointEventTag) | |
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 143 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 146 of file qgraphicssceneevent.h.
Constructs a graphics scene context menu event of the specified type.
Definition at line 942 of file qgraphicssceneevent.cpp.
QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent | ( | ) |
Destroys the event.
Definition at line 950 of file qgraphicssceneevent.cpp.
Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers | ( | ) | const |
Returns the keyboard modifiers in use when the context menu was requested.
Definition at line 1032 of file qgraphicssceneevent.cpp.
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 960 of file qgraphicssceneevent.cpp.
QGraphicsSceneContextMenuEvent::Reason QGraphicsSceneContextMenuEvent::reason | ( | ) | const |
Returns the reason for the context menu event.
Definition at line 1055 of file qgraphicssceneevent.cpp.
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 985 of file qgraphicssceneevent.cpp.
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 1010 of file qgraphicssceneevent.cpp.
void QGraphicsSceneContextMenuEvent::setModifiers | ( | Qt::KeyboardModifiers | modifiers | ) |
Sets the keyboard modifiers associated with the context menu to the modifiers specified.
Definition at line 1044 of file qgraphicssceneevent.cpp.
Sets the position associated with the context menu to the given point in item coordinates.
Definition at line 973 of file qgraphicssceneevent.cpp.
Sets the reason for the context menu event to reason.
Definition at line 1067 of file qgraphicssceneevent.cpp.
Sets the position associated with the context menu to the given point in scene coordinates.
Definition at line 998 of file qgraphicssceneevent.cpp.
Sets the position associated with the context menu to the given point in screen coordinates.
Definition at line 1023 of file qgraphicssceneevent.cpp.