QtBase
v6.3.1
|
The QContextMenuEvent class contains parameters that describe a context menu event. \inmodule QtGui. More...
#include <qevent.h>
Protected Attributes | |
QPoint | m_pos |
QPoint | m_globalPos |
uint | m_reason: 8 |
Protected Attributes inherited from QInputEvent | |
const QInputDevice * | m_dev = nullptr |
quint64 | m_timeStamp = 0 |
Qt::KeyboardModifiers | m_modState = Qt::NoModifier |
quint32 | m_reserved = 0 |
Protected Attributes inherited from QEvent | |
quint16 | t |
Additional Inherited Members | |
Static Public Member Functions inherited from QEvent | |
static int | registerEventType (int hint=-1) noexcept |
Protected Member Functions inherited from QInputEvent | |
QInputEvent (Type type, PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
QInputEvent (Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
Protected Member Functions inherited from QEvent | |
QEvent (Type type, InputEventTag) | |
QEvent (Type type, PointerEventTag) | |
QEvent (Type type, SinglePointEventTag) | |
The QContextMenuEvent class contains parameters that describe a context menu event. \inmodule QtGui.
Context menu events are sent to widgets when a user performs an action associated with opening a context menu. The actions required to open context menus vary between platforms; for example, on Windows, pressing the menu button or clicking the right mouse button will cause this event to be sent.
When this event occurs it is customary to show a QMenu with a context menu, if this is relevant to the context.
This enum describes the reason why the event was sent.
\value Mouse The mouse caused the event to be sent. Normally this means the right mouse button was clicked, but this is platform dependent.
\value Keyboard The keyboard caused this event to be sent. On Windows, 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 |
QContextMenuEvent::QContextMenuEvent | ( | Reason | reason, |
const QPoint & | pos, | ||
const QPoint & | globalPos, | ||
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) |
Constructs a context menu event object with the accept parameter flag set to false.
The reason parameter must be QContextMenuEvent::Mouse or QContextMenuEvent::Keyboard.
The pos parameter specifies the mouse position relative to the receiving widget. globalPos is the mouse position in absolute coordinates. The modifiers holds the keyboard modifiers.
Definition at line 2007 of file qevent.cpp.
Constructs a context menu event object with the accept parameter flag set to false.
The reason parameter must be QContextMenuEvent::Mouse or QContextMenuEvent::Keyboard.
The pos parameter specifies the mouse position relative to the receiving widget.
The globalPos() is initialized to QCursor::pos(), which may not be appropriate. Use the other constructor to specify the global position explicitly.
Definition at line 2031 of file qevent.cpp.
QContextMenuEvent::~QContextMenuEvent | ( | ) |
Definition at line 2014 of file qevent.cpp.
|
inlineoverridevirtual |
|
inline |
Returns the global x position of the mouse pointer at the time of the event.
|
inline |
Returns the global y position of the mouse pointer at the time of the event.
Returns the position of the mouse pointer relative to the widget that received the event.
Definition at line 682 of file qevent.h.
|
inline |
|
inline |
|
inline |