![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework. More...
#include <qgraphicssceneevent.h>
Public Member Functions | |
QGraphicsSceneMouseEvent (Type type=None) | |
~QGraphicsSceneMouseEvent () | |
Destroys the event. | |
QPointF | pos () const |
Returns the mouse cursor position in item coordinates. | |
void | setPos (const QPointF &pos) |
QPointF | scenePos () const |
Returns the mouse cursor position in scene coordinates. | |
void | setScenePos (const QPointF &pos) |
QPoint | screenPos () const |
Returns the mouse cursor position in screen coordinates. | |
void | setScreenPos (const QPoint &pos) |
QPointF | buttonDownPos (Qt::MouseButton button) const |
Returns the mouse cursor position in item coordinates where the specified button was clicked. | |
void | setButtonDownPos (Qt::MouseButton button, const QPointF &pos) |
QPointF | buttonDownScenePos (Qt::MouseButton button) const |
Returns the mouse cursor position in scene coordinates where the specified button was clicked. | |
void | setButtonDownScenePos (Qt::MouseButton button, const QPointF &pos) |
QPoint | buttonDownScreenPos (Qt::MouseButton button) const |
Returns the mouse cursor position in screen coordinates where the specified button was clicked. | |
void | setButtonDownScreenPos (Qt::MouseButton button, const QPoint &pos) |
QPointF | lastPos () const |
Returns the last recorded mouse cursor position in item coordinates. | |
void | setLastPos (const QPointF &pos) |
QPointF | lastScenePos () const |
Returns the last recorded mouse cursor position in scene coordinates. | |
void | setLastScenePos (const QPointF &pos) |
QPoint | lastScreenPos () const |
Returns the last recorded mouse cursor position in screen coordinates. | |
void | setLastScreenPos (const QPoint &pos) |
Qt::MouseButtons | buttons () const |
Returns the combination of mouse buttons that were pressed at the time the event was sent. | |
void | setButtons (Qt::MouseButtons buttons) |
Qt::MouseButton | button () const |
Returns the mouse button (if any) that caused the event. | |
void | setButton (Qt::MouseButton button) |
Qt::KeyboardModifiers | modifiers () const |
Returns the keyboard modifiers in use at the time the event was sent. | |
void | setModifiers (Qt::KeyboardModifiers modifiers) |
Qt::MouseEventSource | source () const |
void | setSource (Qt::MouseEventSource source) |
Qt::MouseEventFlags | flags () const |
void | setFlags (Qt::MouseEventFlags) |
Public Member Functions inherited from QGraphicsSceneEvent | |
QGraphicsSceneEvent (Type type) | |
~QGraphicsSceneEvent () | |
Destroys the event. | |
QWidget * | widget () const |
Returns the widget where the event originated, or \nullptr if the event originates from another application. | |
void | setWidget (QWidget *widget) |
quint64 | timestamp () const |
void | setTimestamp (quint64 ts) |
Public Member Functions inherited from QEvent | |
QEvent (Type type) | |
Constructs an event object of type type. | |
virtual | ~QEvent () |
Destroys the event. | |
Type | type () const |
Returns the event type. | |
bool | spontaneous () const |
Returns true if the event originated outside the application (a system event); otherwise returns false . | |
virtual void | setAccepted (bool accepted) |
bool | isAccepted () const |
void | accept () |
Sets the accept flag of the event object, the equivalent of calling setAccepted(true). | |
void | ignore () |
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false). | |
bool | isInputEvent () const noexcept |
bool | isPointerEvent () const noexcept |
bool | isSinglePointEvent () const noexcept |
virtual QEvent * | clone () const |
Creates and returns an identical copy of this event. |
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
\inmodule QtWidgets
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 \l{QGraphicsView::}{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().
Definition at line 47 of file qgraphicssceneevent.h.
Constructs a generic graphics scene mouse event of the specified type.
Definition at line 357 of file qgraphicssceneevent.cpp.
QGraphicsSceneMouseEvent::~QGraphicsSceneMouseEvent | ( | ) |
Destroys the event.
Definition at line 365 of file qgraphicssceneevent.cpp.
Qt::MouseButton QGraphicsSceneMouseEvent::button | ( | ) | const |
Returns the mouse button (if any) that caused the event.
Definition at line 585 of file qgraphicssceneevent.cpp.
QPointF QGraphicsSceneMouseEvent::buttonDownPos | ( | Qt::MouseButton | button | ) | const |
Returns the mouse cursor position in item coordinates where the specified button was clicked.
Definition at line 435 of file qgraphicssceneevent.cpp.
QPointF QGraphicsSceneMouseEvent::buttonDownScenePos | ( | Qt::MouseButton | button | ) | const |
Returns the mouse cursor position in scene coordinates where the specified button was clicked.
Definition at line 456 of file qgraphicssceneevent.cpp.
QPoint QGraphicsSceneMouseEvent::buttonDownScreenPos | ( | Qt::MouseButton | button | ) | const |
Returns the mouse cursor position in screen coordinates where the specified button was clicked.
Definition at line 477 of file qgraphicssceneevent.cpp.
Qt::MouseButtons QGraphicsSceneMouseEvent::buttons | ( | ) | const |
Returns the combination of mouse buttons that were pressed at the time the event was sent.
Definition at line 565 of file qgraphicssceneevent.cpp.
Qt::MouseEventFlags QGraphicsSceneMouseEvent::flags | ( | ) | const |
Returns the mouse event flags.
The mouse event flags provide additional information about a mouse event.
Definition at line 650 of file qgraphicssceneevent.cpp.
QPointF QGraphicsSceneMouseEvent::lastPos | ( | ) | const |
Returns the last recorded mouse cursor position in item coordinates.
Definition at line 498 of file qgraphicssceneevent.cpp.
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.
Definition at line 521 of file qgraphicssceneevent.cpp.
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.
Definition at line 544 of file qgraphicssceneevent.cpp.
Qt::KeyboardModifiers QGraphicsSceneMouseEvent::modifiers | ( | ) | const |
Returns the keyboard modifiers in use at the time the event was sent.
Definition at line 606 of file qgraphicssceneevent.cpp.
QPointF QGraphicsSceneMouseEvent::pos | ( | ) | const |
Returns the mouse cursor position in item coordinates.
Definition at line 374 of file qgraphicssceneevent.cpp.
QPointF QGraphicsSceneMouseEvent::scenePos | ( | ) | const |
Returns the mouse cursor position in scene coordinates.
Definition at line 394 of file qgraphicssceneevent.cpp.
QPoint QGraphicsSceneMouseEvent::screenPos | ( | ) | const |
Returns the mouse cursor position in screen coordinates.
Definition at line 414 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setButton | ( | Qt::MouseButton | button | ) |
Definition at line 594 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setButtonDownPos | ( | Qt::MouseButton | button, |
const QPointF & | pos ) |
Definition at line 444 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setButtonDownScenePos | ( | Qt::MouseButton | button, |
const QPointF & | pos ) |
Definition at line 465 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setButtonDownScreenPos | ( | Qt::MouseButton | button, |
const QPoint & | pos ) |
Definition at line 486 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setButtons | ( | Qt::MouseButtons | buttons | ) |
Definition at line 574 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setFlags | ( | Qt::MouseEventFlags | flags | ) |
Definition at line 660 of file qgraphicssceneevent.cpp.
Definition at line 507 of file qgraphicssceneevent.cpp.
Definition at line 530 of file qgraphicssceneevent.cpp.
Definition at line 553 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setModifiers | ( | Qt::KeyboardModifiers | modifiers | ) |
Definition at line 669 of file qgraphicssceneevent.cpp.
Definition at line 383 of file qgraphicssceneevent.cpp.
Definition at line 403 of file qgraphicssceneevent.cpp.
Definition at line 423 of file qgraphicssceneevent.cpp.
void QGraphicsSceneMouseEvent::setSource | ( | Qt::MouseEventSource | source | ) |
Definition at line 634 of file qgraphicssceneevent.cpp.
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.
Definition at line 624 of file qgraphicssceneevent.cpp.