In questa pagina

QGraphicsSceneMouseEvent Class

La classe QGraphicsSceneMouseEvent fornisce gli eventi del mouse nel framework della vista grafica. Per saperne di più...

Intestazione: #include <QGraphicsSceneMouseEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
Eredita da: QGraphicsSceneEvent

Funzioni pubbliche

virtual ~QGraphicsSceneMouseEvent()
Qt::MouseButton button() const
QPointF buttonDownPos(Qt::MouseButton button) const
QPointF buttonDownScenePos(Qt::MouseButton button) const
QPoint buttonDownScreenPos(Qt::MouseButton button) const
Qt::MouseButtons buttons() const
Qt::MouseEventFlags flags() const
QPointF lastPos() const
QPointF lastScenePos() const
QPoint lastScreenPos() const
Qt::KeyboardModifiers modifiers() const
QPointF pos() const
QPointF scenePos() const
QPoint screenPos() const
Qt::MouseEventSource source() const

Descrizione dettagliata

Quando un oggetto ` QGraphicsView ` riceve un evento ` QMouseEvent`, lo converte in un `QGraphicsSceneMouseEvent`. L'evento viene quindi inoltrato all'oggetto ` QGraphicsScene ` associato alla vista. Se l'evento non viene gestito dalla scena, la vista può utilizzarlo, ad esempio per l'` DragMode`.

Oltre a contenere le coordinate dell’elemento, della scena e dello schermo relative all’evento (come pos(), scenePos() e screenPos()), gli eventi del mouse contengono anche le coordinate dell’evento del mouse precedente ricevuto dalla vista. Queste possono essere recuperate con lastPos(), lastScreenPos() e lastScenePos().

Vedi anche QGraphicsSceneContextMenuEvent, QGraphicsSceneHoverEvent, QGraphicsSceneWheelEvent e QMouseEvent.

Documentazione sulle funzioni membro

[virtual noexcept] QGraphicsSceneMouseEvent::~QGraphicsSceneMouseEvent()

Elimina l'evento.

Qt::MouseButton QGraphicsSceneMouseEvent::button() const

Restituisce il pulsante del mouse (se presente) che ha generato l'evento.

Vedi anche buttons() e modifiers().

QPointF QGraphicsSceneMouseEvent::buttonDownPos(Qt::MouseButton button) const

Restituisce la posizione del cursore del mouse nelle coordinate dell'elemento in cui è stato cliccato l'button e specificato.

Vedi anche buttonDownScenePos(), buttonDownScreenPos() e pos().

QPointF QGraphicsSceneMouseEvent::buttonDownScenePos(Qt::MouseButton button) const

Restituisce la posizione del cursore del mouse nelle coordinate della scena nel punto in cui è stato cliccato l'button e specificato.

Vedi anche buttonDownPos(), buttonDownScreenPos() e scenePos().

QPoint QGraphicsSceneMouseEvent::buttonDownScreenPos(Qt::MouseButton button) const

Restituisce la posizione del cursore del mouse, espressa in coordinate dello schermo, nel punto in cui è stato cliccato l'button e specificato.

Vedi anche screenPos(), buttonDownPos() e buttonDownScenePos().

Qt::MouseButtons QGraphicsSceneMouseEvent::buttons() const

Restituisce la combinazione dei pulsanti del mouse che erano stati premuti nel momento in cui è stato inviato l'evento.

Vedi anche button() e modifiers().

Qt::MouseEventFlags QGraphicsSceneMouseEvent::flags() const

Restituisce i flag dell'evento del mouse.

I flag degli eventi del mouse forniscono ulteriori informazioni su un evento del mouse.

Vedi anche Qt::MouseEventFlag e QMouseEvent::flags().

QPointF QGraphicsSceneMouseEvent::lastPos() const

Restituisce l'ultima posizione registrata del cursore del mouse nelle coordinate dell'elemento.

Vedi anche lastScenePos(), lastScreenPos() e pos().

QPointF QGraphicsSceneMouseEvent::lastScenePos() const

Restituisce l'ultima posizione registrata del cursore del mouse nelle coordinate della scena. L'ultima posizione registrata è quella dell'evento del mouse precedente ricevuto dalla vista che ha generato l'evento.

Vedi anche lastPos(), lastScreenPos() e scenePos().

QPoint QGraphicsSceneMouseEvent::lastScreenPos() const

Restituisce l'ultima posizione registrata del cursore del mouse in coordinate dello schermo. L'ultima posizione registrata è quella dell'evento del mouse precedente ricevuto dalla vista che ha generato l'evento.

Vedi anche lastPos(), lastScenePos() e screenPos().

Qt::KeyboardModifiers QGraphicsSceneMouseEvent::modifiers() const

Restituisce i modificatori di tastiera attivi al momento dell'invio dell'evento.

Vedi anche buttons() e button().

QPointF QGraphicsSceneMouseEvent::pos() const

Restituisce la posizione del cursore del mouse nelle coordinate dell'elemento.

Vedi anche scenePos(), screenPos() e lastPos().

QPointF QGraphicsSceneMouseEvent::scenePos() const

Restituisce la posizione del cursore del mouse nelle coordinate della scena.

Vedi anche pos(), screenPos() e lastScenePos().

QPoint QGraphicsSceneMouseEvent::screenPos() const

Restituisce la posizione del cursore del mouse in coordinate dello schermo.

Vedi anche pos(), scenePos() e lastScreenPos().

Qt::MouseEventSource QGraphicsSceneMouseEvent::source() const

Restituisce informazioni sulla fonte dell'evento del mouse.

L'origine dell'evento del mouse può essere utilizzata per distinguere tra eventi del mouse autentici e artificiali. Questi ultimi sono eventi sintetizzati a partire da eventi tattili dal sistema operativo o dallo stesso Qt.

Vedi anche Qt::MouseEventSource e QMouseEvent::source().

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.