#[repr(C)]pub struct QGraphicsSceneMouseEvent { /* private fields */ }
Expand description
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
C++ class: QGraphicsSceneMouseEvent
.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
When a QGraphicsView receives a QMouseEvent, it translates it to a QGraphicsSceneMouseEvent. The event is then forwarded to the QGraphicsScene associated with the view. If the event is not handled by the scene, the view may use it, e.g., for the DragMode.
In addition to containing the item, scene, and screen coordinates of the event (as pos(), scenePos(), and screenPos()), mouse events also contain the coordinates of the previous mouse event received by the view. These can be retrieved with lastPos(), lastScreenPos(), and lastScenePos().
Implementations§
Source§impl QGraphicsSceneMouseEvent
impl QGraphicsSceneMouseEvent
Returns the mouse button (if any) that caused the event.
Calls C++ function: Qt::MouseButton QGraphicsSceneMouseEvent::button() const
.
Returns the mouse cursor position in item coordinates where the specified button was clicked.
Calls C++ function: QPointF QGraphicsSceneMouseEvent::buttonDownPos(Qt::MouseButton button) const
.
Returns the mouse cursor position in item coordinates where the specified button was clicked.
See also buttonDownScenePos(), buttonDownScreenPos(), and pos().
Returns the mouse cursor position in scene coordinates where the specified button was clicked.
Calls C++ function: QPointF QGraphicsSceneMouseEvent::buttonDownScenePos(Qt::MouseButton button) const
.
Returns the mouse cursor position in scene coordinates where the specified button was clicked.
See also buttonDownPos(), buttonDownScreenPos(), and scenePos().
Returns the mouse cursor position in screen coordinates where the specified button was clicked.
Calls C++ function: QPoint QGraphicsSceneMouseEvent::buttonDownScreenPos(Qt::MouseButton button) const
.
Returns the mouse cursor position in screen coordinates where the specified button was clicked.
See also screenPos(), buttonDownPos(), and buttonDownScenePos().
Returns the combination of mouse buttons that were pressed at the time the event was sent.
Calls C++ function: QFlags<Qt::MouseButton> QGraphicsSceneMouseEvent::buttons() const
.
Sourcepub unsafe fn flags(&self) -> QFlags<MouseEventFlag>
pub unsafe fn flags(&self) -> QFlags<MouseEventFlag>
Returns the mouse event flags.
Calls C++ function: QFlags<Qt::MouseEventFlag> QGraphicsSceneMouseEvent::flags() const
.
Returns the mouse event flags.
The mouse event flags provide additional information about a mouse event.
This function was introduced in Qt 5.4.
See also Qt::MouseEventFlag and QMouseEvent::flags().
Sourcepub unsafe fn last_pos(&self) -> CppBox<QPointF>
pub unsafe fn last_pos(&self) -> CppBox<QPointF>
Returns the last recorded mouse cursor position in item coordinates.
Calls C++ function: QPointF QGraphicsSceneMouseEvent::lastPos() const
.
Returns the last recorded mouse cursor position in item coordinates.
See also lastScenePos(), lastScreenPos(), and pos().
Sourcepub unsafe fn last_scene_pos(&self) -> CppBox<QPointF>
pub unsafe fn last_scene_pos(&self) -> CppBox<QPointF>
Returns the last recorded mouse cursor position in scene coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.
Calls C++ function: QPointF QGraphicsSceneMouseEvent::lastScenePos() const
.
Returns the last recorded mouse cursor position in scene coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.
See also lastPos(), lastScreenPos(), and scenePos().
Sourcepub unsafe fn last_screen_pos(&self) -> CppBox<QPoint>
pub unsafe fn last_screen_pos(&self) -> CppBox<QPoint>
Returns the last recorded mouse cursor position in screen coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.
Calls C++ function: QPoint QGraphicsSceneMouseEvent::lastScreenPos() const
.
Returns the last recorded mouse cursor position in screen coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.
See also lastPos(), lastScenePos(), and screenPos().
Sourcepub unsafe fn modifiers(&self) -> QFlags<KeyboardModifier>
pub unsafe fn modifiers(&self) -> QFlags<KeyboardModifier>
Returns the keyboard modifiers in use at the time the event was sent.
Calls C++ function: QFlags<Qt::KeyboardModifier> QGraphicsSceneMouseEvent::modifiers() const
.
Sourcepub unsafe fn new_1a(type_: Type) -> CppBox<QGraphicsSceneMouseEvent>
pub unsafe fn new_1a(type_: Type) -> CppBox<QGraphicsSceneMouseEvent>
Calls C++ function: [constructor] void QGraphicsSceneMouseEvent::QGraphicsSceneMouseEvent(QEvent::Type type = …)
.
Sourcepub unsafe fn new_0a() -> CppBox<QGraphicsSceneMouseEvent>
pub unsafe fn new_0a() -> CppBox<QGraphicsSceneMouseEvent>
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
Calls C++ function: [constructor] void QGraphicsSceneMouseEvent::QGraphicsSceneMouseEvent()
.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
When a QGraphicsView receives a QMouseEvent, it translates it to a QGraphicsSceneMouseEvent. The event is then forwarded to the QGraphicsScene associated with the view. If the event is not handled by the scene, the view may use it, e.g., for the DragMode.
In addition to containing the item, scene, and screen coordinates of the event (as pos(), scenePos(), and screenPos()), mouse events also contain the coordinates of the previous mouse event received by the view. These can be retrieved with lastPos(), lastScreenPos(), and lastScenePos().
Sourcepub unsafe fn pos(&self) -> CppBox<QPointF>
pub unsafe fn pos(&self) -> CppBox<QPointF>
Returns the mouse cursor position in item coordinates.
Calls C++ function: QPointF QGraphicsSceneMouseEvent::pos() const
.
Sourcepub unsafe fn scene_pos(&self) -> CppBox<QPointF>
pub unsafe fn scene_pos(&self) -> CppBox<QPointF>
Returns the mouse cursor position in scene coordinates.
Calls C++ function: QPointF QGraphicsSceneMouseEvent::scenePos() const
.
Returns the mouse cursor position in scene coordinates.
See also pos(), screenPos(), and lastScenePos().
Sourcepub unsafe fn screen_pos(&self) -> CppBox<QPoint>
pub unsafe fn screen_pos(&self) -> CppBox<QPoint>
Returns the mouse cursor position in screen coordinates.
Calls C++ function: QPoint QGraphicsSceneMouseEvent::screenPos() const
.
Returns the mouse cursor position in screen coordinates.
See also pos(), scenePos(), and lastScreenPos().
Calls C++ function: void QGraphicsSceneMouseEvent::setButton(Qt::MouseButton button)
.
Calls C++ function: void QGraphicsSceneMouseEvent::setButtonDownPos(Qt::MouseButton button, const QPointF& pos)
.
Calls C++ function: void QGraphicsSceneMouseEvent::setButtonDownScenePos(Qt::MouseButton button, const QPointF& pos)
.
Calls C++ function: void QGraphicsSceneMouseEvent::setButtonDownScreenPos(Qt::MouseButton button, const QPoint& pos)
.
Calls C++ function: void QGraphicsSceneMouseEvent::setButtons(QFlags<Qt::MouseButton> buttons)
.
Sourcepub unsafe fn set_flags(&self, arg1: QFlags<MouseEventFlag>)
pub unsafe fn set_flags(&self, arg1: QFlags<MouseEventFlag>)
Calls C++ function: void QGraphicsSceneMouseEvent::setFlags(QFlags<Qt::MouseEventFlag> arg1)
.
Sourcepub unsafe fn set_last_pos(&self, pos: impl CastInto<Ref<QPointF>>)
pub unsafe fn set_last_pos(&self, pos: impl CastInto<Ref<QPointF>>)
Calls C++ function: void QGraphicsSceneMouseEvent::setLastPos(const QPointF& pos)
.
Sourcepub unsafe fn set_last_scene_pos(&self, pos: impl CastInto<Ref<QPointF>>)
pub unsafe fn set_last_scene_pos(&self, pos: impl CastInto<Ref<QPointF>>)
Calls C++ function: void QGraphicsSceneMouseEvent::setLastScenePos(const QPointF& pos)
.
Sourcepub unsafe fn set_last_screen_pos(&self, pos: impl CastInto<Ref<QPoint>>)
pub unsafe fn set_last_screen_pos(&self, pos: impl CastInto<Ref<QPoint>>)
Calls C++ function: void QGraphicsSceneMouseEvent::setLastScreenPos(const QPoint& pos)
.
Sourcepub unsafe fn set_modifiers(&self, modifiers: QFlags<KeyboardModifier>)
pub unsafe fn set_modifiers(&self, modifiers: QFlags<KeyboardModifier>)
Calls C++ function: void QGraphicsSceneMouseEvent::setModifiers(QFlags<Qt::KeyboardModifier> modifiers)
.
Sourcepub unsafe fn set_pos(&self, pos: impl CastInto<Ref<QPointF>>)
pub unsafe fn set_pos(&self, pos: impl CastInto<Ref<QPointF>>)
Calls C++ function: void QGraphicsSceneMouseEvent::setPos(const QPointF& pos)
.
Sourcepub unsafe fn set_scene_pos(&self, pos: impl CastInto<Ref<QPointF>>)
pub unsafe fn set_scene_pos(&self, pos: impl CastInto<Ref<QPointF>>)
Calls C++ function: void QGraphicsSceneMouseEvent::setScenePos(const QPointF& pos)
.
Sourcepub unsafe fn set_screen_pos(&self, pos: impl CastInto<Ref<QPoint>>)
pub unsafe fn set_screen_pos(&self, pos: impl CastInto<Ref<QPoint>>)
Calls C++ function: void QGraphicsSceneMouseEvent::setScreenPos(const QPoint& pos)
.
Sourcepub unsafe fn set_source(&self, source: MouseEventSource)
pub unsafe fn set_source(&self, source: MouseEventSource)
Calls C++ function: void QGraphicsSceneMouseEvent::setSource(Qt::MouseEventSource source)
.
Sourcepub unsafe fn source(&self) -> MouseEventSource
pub unsafe fn source(&self) -> MouseEventSource
Returns information about the mouse event source.
Calls C++ function: Qt::MouseEventSource QGraphicsSceneMouseEvent::source() const
.
Returns information about the mouse event source.
The mouse event source can be used to distinguish between genuine and artificial mouse events. The latter are events that are synthesized from touch events by the operating system or Qt itself.
This function was introduced in Qt 5.4.
See also Qt::MouseEventSource and QMouseEvent::source().
Methods from Deref<Target = QGraphicsSceneEvent>§
Sourcepub unsafe fn set_widget(&self, widget: impl CastInto<Ptr<QWidget>>)
pub unsafe fn set_widget(&self, widget: impl CastInto<Ptr<QWidget>>)
Calls C++ function: void QGraphicsSceneEvent::setWidget(QWidget* widget)
.
Sourcepub unsafe fn widget(&self) -> QPtr<QWidget>
pub unsafe fn widget(&self) -> QPtr<QWidget>
Returns the widget where the event originated, or 0 if the event originates from another application.
Calls C++ function: QWidget* QGraphicsSceneEvent::widget() const
.
Returns the widget where the event originated, or 0 if the event originates from another application.
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 QGraphicsSceneMouseEvent
impl CppDeletable for QGraphicsSceneMouseEvent
Source§impl Deref for QGraphicsSceneMouseEvent
impl Deref for QGraphicsSceneMouseEvent
Source§fn deref(&self) -> &QGraphicsSceneEvent
fn deref(&self) -> &QGraphicsSceneEvent
Calls C++ function: QGraphicsSceneEvent* static_cast<QGraphicsSceneEvent*>(QGraphicsSceneMouseEvent* ptr)
.
Source§type Target = QGraphicsSceneEvent
type Target = QGraphicsSceneEvent
Source§impl DynamicCast<QGraphicsSceneMouseEvent> for QEvent
impl DynamicCast<QGraphicsSceneMouseEvent> for QEvent
Source§unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QGraphicsSceneMouseEvent>
unsafe fn dynamic_cast(ptr: Ptr<QEvent>) -> Ptr<QGraphicsSceneMouseEvent>
Calls C++ function: QGraphicsSceneMouseEvent* dynamic_cast<QGraphicsSceneMouseEvent*>(QEvent* ptr)
.
Source§impl DynamicCast<QGraphicsSceneMouseEvent> for QGraphicsSceneEvent
impl DynamicCast<QGraphicsSceneMouseEvent> for QGraphicsSceneEvent
Source§unsafe fn dynamic_cast(
ptr: Ptr<QGraphicsSceneEvent>,
) -> Ptr<QGraphicsSceneMouseEvent>
unsafe fn dynamic_cast( ptr: Ptr<QGraphicsSceneEvent>, ) -> Ptr<QGraphicsSceneMouseEvent>
Calls C++ function: QGraphicsSceneMouseEvent* dynamic_cast<QGraphicsSceneMouseEvent*>(QGraphicsSceneEvent* ptr)
.
Source§impl StaticDowncast<QGraphicsSceneMouseEvent> for QEvent
impl StaticDowncast<QGraphicsSceneMouseEvent> for QEvent
Source§unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QGraphicsSceneMouseEvent>
unsafe fn static_downcast(ptr: Ptr<QEvent>) -> Ptr<QGraphicsSceneMouseEvent>
Calls C++ function: QGraphicsSceneMouseEvent* static_cast<QGraphicsSceneMouseEvent*>(QEvent* ptr)
.
Source§impl StaticDowncast<QGraphicsSceneMouseEvent> for QGraphicsSceneEvent
impl StaticDowncast<QGraphicsSceneMouseEvent> for QGraphicsSceneEvent
Source§unsafe fn static_downcast(
ptr: Ptr<QGraphicsSceneEvent>,
) -> Ptr<QGraphicsSceneMouseEvent>
unsafe fn static_downcast( ptr: Ptr<QGraphicsSceneEvent>, ) -> Ptr<QGraphicsSceneMouseEvent>
Calls C++ function: QGraphicsSceneMouseEvent* static_cast<QGraphicsSceneMouseEvent*>(QGraphicsSceneEvent* ptr)
.
Source§impl StaticUpcast<QEvent> for QGraphicsSceneMouseEvent
impl StaticUpcast<QEvent> for QGraphicsSceneMouseEvent
Source§unsafe fn static_upcast(ptr: Ptr<QGraphicsSceneMouseEvent>) -> Ptr<QEvent>
unsafe fn static_upcast(ptr: Ptr<QGraphicsSceneMouseEvent>) -> Ptr<QEvent>
Calls C++ function: QEvent* static_cast<QEvent*>(QGraphicsSceneMouseEvent* ptr)
.
Source§impl StaticUpcast<QGraphicsSceneEvent> for QGraphicsSceneMouseEvent
impl StaticUpcast<QGraphicsSceneEvent> for QGraphicsSceneMouseEvent
Source§unsafe fn static_upcast(
ptr: Ptr<QGraphicsSceneMouseEvent>,
) -> Ptr<QGraphicsSceneEvent>
unsafe fn static_upcast( ptr: Ptr<QGraphicsSceneMouseEvent>, ) -> Ptr<QGraphicsSceneEvent>
Calls C++ function: QGraphicsSceneEvent* static_cast<QGraphicsSceneEvent*>(QGraphicsSceneMouseEvent* ptr)
.