Qt 4.8
|
The QContextMenuEvent class contains parameters that describe a context menu event. More...
#include <qevent.h>
Public Functions | |
const QPoint & | globalPos () const |
Returns the global position of the mouse pointer at the time of the event. More... | |
int | globalX () const |
Returns the global x position of the mouse pointer at the time of the event. More... | |
int | globalY () const |
Returns the global y position of the mouse pointer at the time of the event. More... | |
const QPoint & | pos () const |
Returns the position of the mouse pointer relative to the widget that received the event. More... | |
QContextMenuEvent (Reason reason, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers) | |
Constructs a context menu event object with the accept parameter flag set to false. More... | |
QContextMenuEvent (Reason reason, const QPoint &pos, const QPoint &globalPos) | |
Constructs a context menu event object with the accept parameter flag set to false. More... | |
QContextMenuEvent (Reason reason, const QPoint &pos) | |
Constructs a context menu event object with the accept parameter flag set to false. More... | |
Reason | reason () const |
Returns the reason for this context event. More... | |
int | x () const |
Returns the x position of the mouse pointer, relative to the widget that received the event. More... | |
int | y () const |
Returns the y position of the mouse pointer, relative to the widget that received the event. More... | |
~QContextMenuEvent () | |
Public Functions inherited from QInputEvent | |
Qt::KeyboardModifiers | modifiers () const |
Returns the keyboard modifier flags that existed immediately before the event occurred. More... | |
QInputEvent (Type type, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
void | setModifiers (Qt::KeyboardModifiers amodifiers) |
Sets the keyboard modifiers flags for this event. More... | |
~QInputEvent () | |
Public Functions inherited from QEvent | |
void | accept () |
Sets the accept flag of the event object, the equivalent of calling setAccepted(true). More... | |
void | ignore () |
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false). More... | |
bool | isAccepted () const |
QEvent (Type type) | |
Contructs an event object of type type. More... | |
void | setAccepted (bool accepted) |
bool | spontaneous () const |
Returns true if the event originated outside the application (a system event); otherwise returns false. More... | |
Type | type () const |
Returns the event type. More... | |
virtual | ~QEvent () |
Destroys the event. More... | |
Protected Variables | |
QPoint | gp |
QPoint | p |
uint | reas: 8 |
Protected Variables inherited from QInputEvent | |
Qt::KeyboardModifiers | modState |
Protected Variables inherited from QEvent | |
QEventPrivate * | d |
ushort | t |
Additional Inherited Members | |
Static Public Functions inherited from QEvent | |
static int | registerEventType (int hint=-1) |
Registers and returns a custom event type. More... | |
The QContextMenuEvent class contains parameters that describe a context menu event.
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.
Context menu events contain a special accept flag that indicates whether the receiver accepted the event. If the event handler does not accept the event then, if possible, whatever triggered the event will be handled as a regular input event.
This enum describes the reason why the event was sent.
Enumerator | |
---|---|
Mouse | |
Keyboard | |
Other |
QContextMenuEvent::QContextMenuEvent | ( | Reason | reason, |
const QPoint & | pos, | ||
const QPoint & | globalPos, | ||
Qt::KeyboardModifiers | modifiers | ||
) |
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 1629 of file qevent.cpp.
Referenced by QContextMenuEvent().
QContextMenuEvent::QContextMenuEvent | ( | Reason | reason, |
const QPoint & | pos, | ||
const QPoint & | globalPos | ||
) |
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.
Definition at line 1614 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 1664 of file qevent.cpp.
QContextMenuEvent::~QContextMenuEvent | ( | ) |
Definition at line 1647 of file qevent.cpp.
|
inline |
Returns the global position of the mouse pointer at the time of the event.
Definition at line 413 of file qevent.h.
Referenced by QmlJSDebugger::ToolBarColorBox::contextMenuEvent(), QScrollBar::contextMenuEvent(), QMessageBoxDetailsText::TextEdit::contextMenuEvent(), QDialog::contextMenuEvent(), QMdiSubWindow::contextMenuEvent(), QAbstractSpinBox::contextMenuEvent(), QLabel::contextMenuEvent(), QMainWindow::contextMenuEvent(), QLineEdit::contextMenuEvent(), QWorkspaceTitleBar::contextMenuEvent(), QMdiAreaTabBar::contextMenuEvent(), QApplication::notify(), and QTextControl::processEvent().
|
inline |
Returns the global x position of the mouse pointer at the time of the event.
Definition at line 409 of file qevent.h.
|
inline |
Returns the global y position of the mouse pointer at the time of the event.
Definition at line 410 of file qevent.h.
|
inline |
Returns the position of the mouse pointer relative to the widget that received the event.
Definition at line 412 of file qevent.h.
Referenced by QScrollBar::contextMenuEvent(), QDialog::contextMenuEvent(), QMdiSubWindow::contextMenuEvent(), QAbstractSpinBox::contextMenuEvent(), QLabel::contextMenuEvent(), QMainWindow::contextMenuEvent(), QWorkspaceTitleBar::contextMenuEvent(), QMdiAreaTabBar::contextMenuEvent(), QToolBar::event(), QApplication::notify(), and QTextControl::processEvent().
|
inline |
Returns the reason for this context event.
Definition at line 415 of file qevent.h.
Referenced by QGraphicsView::contextMenuEvent(), QApplication::notify(), and QContextMenuEvent().
|
inline |
|
inline |
|
protected |
Definition at line 425 of file qevent.h.
Referenced by QContextMenuEvent().
|
protected |
Definition at line 424 of file qevent.h.
Referenced by QContextMenuEvent().
|
protected |
Definition at line 426 of file qevent.h.
Referenced by QContextMenuEvent().