com.trolltech.qt.gui
Class QContextMenuEvent

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QEvent
                  extended by com.trolltech.qt.gui.QInputEvent
                      extended by com.trolltech.qt.gui.QContextMenuEvent
All Implemented Interfaces:
QtJambiInterface

public class QContextMenuEvent
extends QInputEvent

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.


Nested Class Summary
static class QContextMenuEvent.Reason
          This enum describes the reason why the event was sent.
 
Nested classes/interfaces inherited from class com.trolltech.qt.core.QEvent
QEvent.Type
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QContextMenuEvent(QContextMenuEvent.Reason reason, QPoint pos)
          Constructs a context menu event object with the accept parameter flag set to false.
QContextMenuEvent(QContextMenuEvent.Reason reason, QPoint pos, QPoint globalPos)
          Constructs a context menu event object with the accept parameter flag set to false.
QContextMenuEvent(QContextMenuEvent.Reason reason, QPoint pos, QPoint globalPos, Qt.KeyboardModifier[] modifiers)
          This is an overloaded method provided for convenience.
QContextMenuEvent(QContextMenuEvent.Reason reason, QPoint pos, QPoint globalPos, Qt.KeyboardModifiers modifiers)
          Constructs a context menu event object with the accept parameter flag set to false.
 
Method Summary
 QPoint globalPos()
          Returns the global position of the mouse pointer at the time of the event.
 int globalX()
          Returns the global x position of the mouse pointer at the time of the event.
 int globalY()
          Returns the global y position of the mouse pointer at the time of the event.
 QPoint pos()
          Returns the position of the mouse pointer relative to the widget that received the event.
 QContextMenuEvent.Reason reason()
          Returns the reason for this context event.
 java.lang.String toString()
          Returns a string representation of the this QContextMenuEvent.
 int x()
          Returns the x position of the mouse pointer, relative to the widget that received the event.
 int y()
          Returns the y position of the mouse pointer, relative to the widget that received the event.
 
Methods inherited from class com.trolltech.qt.gui.QInputEvent
modifiers, modState, setModState, setModState
 
Methods inherited from class com.trolltech.qt.core.QEvent
accept, ignore, isAccepted, registerEventType, registerEventType, setAccepted, setT, spontaneous, t, type
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QContextMenuEvent

public QContextMenuEvent(QContextMenuEvent.Reason reason,
                         QPoint pos)
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.


QContextMenuEvent

public QContextMenuEvent(QContextMenuEvent.Reason reason,
                         QPoint pos,
                         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.


QContextMenuEvent

public QContextMenuEvent(QContextMenuEvent.Reason reason,
                         QPoint pos,
                         QPoint globalPos,
                         Qt.KeyboardModifier[] modifiers)
This is an overloaded method provided for convenience.


QContextMenuEvent

public QContextMenuEvent(QContextMenuEvent.Reason reason,
                         QPoint pos,
                         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.

Method Detail

globalPos

public final QPoint globalPos()
Returns the global position of the mouse pointer at the time of the event.

See also:
x(), y(), and pos().


globalX

public final int globalX()
Returns the global x position of the mouse pointer at the time of the event.

See also:
globalY(), and globalPos().


globalY

public final int globalY()
Returns the global y position of the mouse pointer at the time of the event.

See also:
globalX(), and globalPos().


pos

public final QPoint pos()
Returns the position of the mouse pointer relative to the widget that received the event.

See also:
x(), y(), and globalPos().


reason

public final QContextMenuEvent.Reason reason()
Returns the reason for this context event.


x

public final int x()
Returns the x position of the mouse pointer, relative to the widget that received the event.

See also:
y(), and pos().


y

public final int y()
Returns the y position of the mouse pointer, relative to the widget that received the event.

See also:
x(), and pos().


toString

public java.lang.String toString()
Returns a string representation of the this QContextMenuEvent.

Overrides:
toString in class QInputEvent