#[repr(C)]
pub struct QContextMenuEvent { /* private fields */ }
Expand description

The QContextMenuEvent class contains parameters that describe a context menu event.

C++ class: QContextMenuEvent.

C++ documentation:

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

source

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).

C++ documentation:

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.

source

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.

C++ documentation:

Returns the global position of the mouse pointer at the time of the event.

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

source

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.

C++ documentation:

Returns the global x position of the mouse pointer at the time of the event.

See also globalY() and globalPos().

source

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.

C++ documentation:

Returns the global y position of the mouse pointer at the time of the event.

See also globalX() and globalPos().

source

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).

C++ documentation:

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.

source

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).

C++ documentation:

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.

source

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).

C++ documentation:

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.

source

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).

C++ documentation:

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.

source

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.

C++ documentation:

Returns the position of the mouse pointer relative to the widget that received the event.

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

source

pub unsafe fn reason(&self) -> Reason

Returns the reason for this context event.

Calls C++ function: QContextMenuEvent::Reason QContextMenuEvent::reason() const.

C++ documentation:

Returns the reason for this context event.

source

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.

C++ documentation:

Returns the x position of the mouse pointer, relative to the widget that received the event.

See also y() and pos().

source

pub unsafe fn y(&self) -> c_int

Returns the y position of the mouse pointer, relative to the widget that received the event.

Calls C++ function: int QContextMenuEvent::y() const.

C++ documentation:

Returns the y position of the mouse pointer, relative to the widget that received the event.

See also x() and pos().

Methods from Deref<Target = QInputEvent>§

source

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).

C++ documentation:

The QInputEvent class is the base class for events that describe user input.

source

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.

C++ documentation:

Returns the keyboard modifier flags that existed immediately before the event occurred.

See also QGuiApplication::keyboardModifiers().

source

pub unsafe fn set_modifiers(&self, amodifiers: QFlags<KeyboardModifier>)

Calls C++ function: void QInputEvent::setModifiers(QFlags<Qt::KeyboardModifier> amodifiers).

source

pub unsafe fn set_timestamp(&self, atimestamp: c_ulong)

Calls C++ function: void QInputEvent::setTimestamp(unsigned long atimestamp).

source

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.

C++ documentation:

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>§

source

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().

C++ documentation:

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().

source

pub unsafe fn copy_from(&self, other: impl CastInto<Ref<QEvent>>) -> Ref<QEvent>

Calls C++ function: QEvent& QEvent::operator=(const QEvent& other).

source

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().

C++ documentation:

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().

source

pub unsafe fn is_accepted(&self) -> bool

the accept flag of the event object

Calls C++ function: bool QEvent::isAccepted() const.

C++ documentation:

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)
source

pub unsafe fn set_accepted(&self, accepted: bool)

the accept flag of the event object

Calls C++ function: void QEvent::setAccepted(bool accepted).

C++ documentation:

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)
source

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.

C++ documentation:

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.

source

pub unsafe fn type_(&self) -> Type

Returns the event type.

Calls C++ function: QEvent::Type QEvent::type() const.

C++ documentation:

Returns the event type.

Trait Implementations§

source§

impl CppDeletable for QContextMenuEvent

source§

unsafe fn delete(&self)

Calls C++ function: virtual [destructor] void QContextMenuEvent::~QContextMenuEvent().

source§

impl Deref for QContextMenuEvent

source§

fn deref(&self) -> &QInputEvent

Calls C++ function: QInputEvent* static_cast<QInputEvent*>(QContextMenuEvent* ptr).

§

type Target = QInputEvent

The resulting type after dereferencing.
source§

impl DynamicCast<QContextMenuEvent> for QEvent

source§

unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QContextMenuEvent>

Calls C++ function: QContextMenuEvent* dynamic_cast<QContextMenuEvent*>(QEvent* ptr).

source§

impl DynamicCast<QContextMenuEvent> for QInputEvent

source§

unsafe fn dynamic_cast(ptr: Ptr<QInputEvent>) -> Ptr<QContextMenuEvent>

Calls C++ function: QContextMenuEvent* dynamic_cast<QContextMenuEvent*>(QInputEvent* ptr).

source§

impl StaticDowncast<QContextMenuEvent> for QEvent

source§

unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QContextMenuEvent>

Calls C++ function: QContextMenuEvent* static_cast<QContextMenuEvent*>(QEvent* ptr).

source§

impl StaticDowncast<QContextMenuEvent> for QInputEvent

source§

unsafe fn static_downcast(ptr: Ptr<QInputEvent>) -> Ptr<QContextMenuEvent>

Calls C++ function: QContextMenuEvent* static_cast<QContextMenuEvent*>(QInputEvent* ptr).

source§

impl StaticUpcast<QEvent> for QContextMenuEvent

source§

unsafe fn static_upcast(ptr: Ptr<QContextMenuEvent>) -> Ptr<QEvent>

Calls C++ function: QEvent* static_cast<QEvent*>(QContextMenuEvent* ptr).

source§

impl StaticUpcast<QInputEvent> for QContextMenuEvent

source§

unsafe fn static_upcast(ptr: Ptr<QContextMenuEvent>) -> Ptr<QInputEvent>

Calls C++ function: QInputEvent* static_cast<QInputEvent*>(QContextMenuEvent* ptr).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.