Struct qt_gui::QContextMenuEvent
source · #[repr(C)]pub struct QContextMenuEvent { /* private fields */ }
Expand description
The QContextMenuEvent class contains parameters that describe a context menu event.
C++ class: QContextMenuEvent
.
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.
Implementations§
source§impl QContextMenuEvent
impl QContextMenuEvent
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QContextMenuEvent>>
) -> Ref<QContextMenuEvent>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QContextMenuEvent>> ) -> Ref<QContextMenuEvent>
The QContextMenuEvent class contains parameters that describe a context menu event.
Calls C++ function: QContextMenuEvent& QContextMenuEvent::operator=(const QContextMenuEvent& other)
.
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.
sourcepub unsafe fn global_pos(&self) -> Ref<QPoint>
pub unsafe fn global_pos(&self) -> Ref<QPoint>
Returns the global position of the mouse pointer at the time of the event.
Calls C++ function: const QPoint& QContextMenuEvent::globalPos() const
.
sourcepub unsafe fn global_x(&self) -> c_int
pub unsafe fn global_x(&self) -> c_int
Returns the global x position of the mouse pointer at the time of the event.
Calls C++ function: int QContextMenuEvent::globalX() const
.
sourcepub unsafe fn global_y(&self) -> c_int
pub unsafe fn global_y(&self) -> c_int
Returns the global y position of the mouse pointer at the time of the event.
Calls C++ function: int QContextMenuEvent::globalY() const
.
sourcepub unsafe fn new_4a(
reason: Reason,
pos: impl CastInto<Ref<QPoint>>,
global_pos: impl CastInto<Ref<QPoint>>,
modifiers: QFlags<KeyboardModifier>
) -> CppBox<QContextMenuEvent>
pub unsafe fn new_4a( reason: Reason, pos: impl CastInto<Ref<QPoint>>, global_pos: impl CastInto<Ref<QPoint>>, modifiers: QFlags<KeyboardModifier> ) -> CppBox<QContextMenuEvent>
Constructs a context menu event object with the accept parameter flag set to false.
Calls C++ function: [constructor] void QContextMenuEvent::QContextMenuEvent(QContextMenuEvent::Reason reason, const QPoint& pos, const QPoint& globalPos, QFlags<Qt::KeyboardModifier> 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.
sourcepub unsafe fn new_3a(
reason: Reason,
pos: impl CastInto<Ref<QPoint>>,
global_pos: impl CastInto<Ref<QPoint>>
) -> CppBox<QContextMenuEvent>
pub unsafe fn new_3a( reason: Reason, pos: impl CastInto<Ref<QPoint>>, global_pos: impl CastInto<Ref<QPoint>> ) -> CppBox<QContextMenuEvent>
Constructs a context menu event object with the accept parameter flag set to false.
Calls C++ function: [constructor] void 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.
sourcepub unsafe fn new_2a(
reason: Reason,
pos: impl CastInto<Ref<QPoint>>
) -> CppBox<QContextMenuEvent>
pub unsafe fn new_2a( reason: Reason, pos: impl CastInto<Ref<QPoint>> ) -> CppBox<QContextMenuEvent>
Constructs a context menu event object with the accept parameter flag set to false.
Calls C++ function: [constructor] void QContextMenuEvent::QContextMenuEvent(QContextMenuEvent::Reason reason, const 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.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QContextMenuEvent>>
) -> CppBox<QContextMenuEvent>
pub unsafe fn new_copy( other: impl CastInto<Ref<QContextMenuEvent>> ) -> CppBox<QContextMenuEvent>
The QContextMenuEvent class contains parameters that describe a context menu event.
Calls C++ function: [constructor] void QContextMenuEvent::QContextMenuEvent(const QContextMenuEvent& other)
.
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.
sourcepub unsafe fn pos(&self) -> Ref<QPoint>
pub unsafe fn pos(&self) -> Ref<QPoint>
Returns the position of the mouse pointer relative to the widget that received the event.
Calls C++ function: const QPoint& QContextMenuEvent::pos() const
.
sourcepub unsafe fn reason(&self) -> Reason
pub unsafe fn reason(&self) -> Reason
Returns the reason for this context event.
Calls C++ function: QContextMenuEvent::Reason QContextMenuEvent::reason() const
.
Returns the reason for this context event.
sourcepub unsafe fn x(&self) -> c_int
pub unsafe fn x(&self) -> c_int
Returns the x position of the mouse pointer, relative to the widget that received the event.
Calls C++ function: int QContextMenuEvent::x() const
.
Methods from Deref<Target = QInputEvent>§
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QInputEvent>>
) -> Ref<QInputEvent>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QInputEvent>> ) -> Ref<QInputEvent>
The QInputEvent class is the base class for events that describe user input.
Calls C++ function: QInputEvent& QInputEvent::operator=(const QInputEvent& other)
.
The QInputEvent class is the base class for events that describe user input.
sourcepub unsafe fn modifiers(&self) -> QFlags<KeyboardModifier>
pub unsafe fn modifiers(&self) -> QFlags<KeyboardModifier>
Returns the keyboard modifier flags that existed immediately before the event occurred.
Calls C++ function: QFlags<Qt::KeyboardModifier> QInputEvent::modifiers() const
.
Returns the keyboard modifier flags that existed immediately before the event occurred.
See also QGuiApplication::keyboardModifiers().
sourcepub unsafe fn set_modifiers(&self, amodifiers: QFlags<KeyboardModifier>)
pub unsafe fn set_modifiers(&self, amodifiers: QFlags<KeyboardModifier>)
Calls C++ function: void QInputEvent::setModifiers(QFlags<Qt::KeyboardModifier> amodifiers)
.
sourcepub unsafe fn set_timestamp(&self, atimestamp: c_ulong)
pub unsafe fn set_timestamp(&self, atimestamp: c_ulong)
Calls C++ function: void QInputEvent::setTimestamp(unsigned long atimestamp)
.
sourcepub unsafe fn timestamp(&self) -> c_ulong
pub unsafe fn timestamp(&self) -> c_ulong
Returns the window system's timestamp for this event. It will normally be in milliseconds since some arbitrary point in time, such as the time when the system was started.
Calls C++ function: unsigned long QInputEvent::timestamp() const
.
Returns the window system’s timestamp for this event. It will normally be in milliseconds since some arbitrary point in time, such as the time when the system was started.
Methods from Deref<Target = QEvent>§
sourcepub unsafe fn accept(&self)
pub unsafe fn accept(&self)
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Calls C++ function: void QEvent::accept()
.
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget.
See also ignore().
sourcepub unsafe fn copy_from(&self, other: impl CastInto<Ref<QEvent>>) -> Ref<QEvent>
pub unsafe fn copy_from(&self, other: impl CastInto<Ref<QEvent>>) -> Ref<QEvent>
Calls C++ function: QEvent& QEvent::operator=(const QEvent& other)
.
sourcepub unsafe fn ignore(&self)
pub unsafe fn ignore(&self)
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Calls C++ function: void QEvent::ignore()
.
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Clearing the accept parameter indicates that the event receiver does not want the event. Unwanted events might be propagated to the parent widget.
See also accept().
sourcepub unsafe fn is_accepted(&self) -> bool
pub unsafe fn is_accepted(&self) -> bool
the accept flag of the event object
Calls C++ function: bool QEvent::isAccepted() const
.
the accept flag of the event object
Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.
For convenience, the accept flag can also be set with accept(), and cleared with ignore().
Access functions:
bool | isAccepted() const |
void | setAccepted(bool accepted) |
sourcepub unsafe fn set_accepted(&self, accepted: bool)
pub unsafe fn set_accepted(&self, accepted: bool)
the accept flag of the event object
Calls C++ function: void QEvent::setAccepted(bool accepted)
.
the accept flag of the event object
Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.
For convenience, the accept flag can also be set with accept(), and cleared with ignore().
Access functions:
bool | isAccepted() const |
void | setAccepted(bool accepted) |
sourcepub unsafe fn spontaneous(&self) -> bool
pub unsafe fn spontaneous(&self) -> bool
Returns true
if the event originated outside the application (a system event); otherwise returns false
.
Calls C++ function: bool QEvent::spontaneous() const
.
Returns true
if the event originated outside the application (a system event); otherwise returns false
.
The return value of this function is not defined for paint events.
Trait Implementations§
source§impl CppDeletable for QContextMenuEvent
impl CppDeletable for QContextMenuEvent
source§impl Deref for QContextMenuEvent
impl Deref for QContextMenuEvent
source§fn deref(&self) -> &QInputEvent
fn deref(&self) -> &QInputEvent
Calls C++ function: QInputEvent* static_cast<QInputEvent*>(QContextMenuEvent* ptr)
.
§type Target = QInputEvent
type Target = QInputEvent
source§impl DynamicCast<QContextMenuEvent> for QEvent
impl DynamicCast<QContextMenuEvent> for QEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QContextMenuEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QContextMenuEvent>
Calls C++ function: QContextMenuEvent* dynamic_cast<QContextMenuEvent*>(QEvent* ptr)
.
source§impl DynamicCast<QContextMenuEvent> for QInputEvent
impl DynamicCast<QContextMenuEvent> for QInputEvent
source§unsafe fn dynamic_cast(ptr: Ptr<QInputEvent>) -> Ptr<QContextMenuEvent>
unsafe fn dynamic_cast(ptr: Ptr<QInputEvent>) -> Ptr<QContextMenuEvent>
Calls C++ function: QContextMenuEvent* dynamic_cast<QContextMenuEvent*>(QInputEvent* ptr)
.
source§impl StaticDowncast<QContextMenuEvent> for QEvent
impl StaticDowncast<QContextMenuEvent> for QEvent
source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QContextMenuEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QContextMenuEvent>
Calls C++ function: QContextMenuEvent* static_cast<QContextMenuEvent*>(QEvent* ptr)
.
source§impl StaticDowncast<QContextMenuEvent> for QInputEvent
impl StaticDowncast<QContextMenuEvent> for QInputEvent
source§unsafe fn static_downcast(ptr: Ptr<QInputEvent>) -> Ptr<QContextMenuEvent>
unsafe fn static_downcast(ptr: Ptr<QInputEvent>) -> Ptr<QContextMenuEvent>
Calls C++ function: QContextMenuEvent* static_cast<QContextMenuEvent*>(QInputEvent* ptr)
.
source§impl StaticUpcast<QEvent> for QContextMenuEvent
impl StaticUpcast<QEvent> for QContextMenuEvent
source§unsafe fn static_upcast(ptr: Ptr<QContextMenuEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<QContextMenuEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QContextMenuEvent* ptr)
.
source§impl StaticUpcast<QInputEvent> for QContextMenuEvent
impl StaticUpcast<QInputEvent> for QContextMenuEvent
source§unsafe fn static_upcast(ptr: Ptr<QContextMenuEvent>) -> Ptr<QInputEvent>
unsafe fn static_upcast(ptr: Ptr<QContextMenuEvent>) -> Ptr<QInputEvent>
Calls C++ function: QInputEvent* static_cast<QInputEvent*>(QContextMenuEvent* ptr)
.