In questa pagina

QGraphicsSceneContextMenuEvent Class

La classe QGraphicsSceneContextMenuEvent fornisce gli eventi del menu contestuale nel framework della vista grafica. Per saperne di più...

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

Tipi pubblici

enum Reason { Mouse, Keyboard, Other }

Funzioni pubbliche

virtual ~QGraphicsSceneContextMenuEvent()
Qt::KeyboardModifiers modifiers() const
QPointF pos() const
QGraphicsSceneContextMenuEvent::Reason reason() const
QPointF scenePos() const
QPoint screenPos() const

Descrizione dettagliata

Un evento " QContextMenuEvent " ricevuto da un " QGraphicsView " viene convertito in un "QGraphicsSceneContextMenuEvent". Il metodo " QContextMenuEvent::globalPos()" viene convertito in coordinate di elemento, scena e schermo (rispettivamente "pos()", " scenePos()" e " screenPos()").

Vedi anche QGraphicsSceneMouseEvent, QGraphicsSceneWheelEvent e QContextMenuEvent.

Documentazione sui tipi di membro

enum QGraphicsSceneContextMenuEvent::Reason

Questa enumerazione descrive il motivo per cui è stato inviato l'evento di contesto.

CostanteValoreDescrizione
QGraphicsSceneContextMenuEvent::Mouse0L'evento è stato generato dal mouse. Sulla maggior parte delle piattaforme, ciò significa che è stato cliccato il tasto destro del mouse.
QGraphicsSceneContextMenuEvent::Keyboard1L'evento è stato generato dalla tastiera. Su Windows e macOS, ciò significa che è stato premuto il tasto menu.
QGraphicsSceneContextMenuEvent::Other2L'evento è stato generato in altro modo (cioè non tramite mouse o tastiera).

Documentazione delle funzioni membro

[virtual noexcept] QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent()

Elimina l'evento.

Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers() const

Restituisce i modificatori di tastiera attivi al momento della richiesta del menu contestuale.

QPointF QGraphicsSceneContextMenuEvent::pos() const

Restituisce la posizione del cursore del mouse nelle coordinate dell'elemento nel momento in cui è stato richiesto il menu contestuale.

Vedi anche scenePos() e screenPos().

QGraphicsSceneContextMenuEvent::Reason QGraphicsSceneContextMenuEvent::reason() const

Restituisce il motivo dell'evento del menu contestuale.

Vedi anche QGraphicsSceneContextMenuEvent::Reason.

QPointF QGraphicsSceneContextMenuEvent::scenePos() const

Restituisce la posizione del cursore del mouse nelle coordinate della scena nel momento in cui è stato richiesto il menu contestuale.

Vedi anche pos() e screenPos().

QPoint QGraphicsSceneContextMenuEvent::screenPos() const

Restituisce la posizione del cursore del mouse in coordinate dello schermo nel momento in cui è stato richiesto il menu contestuale.

Vedi anche pos() e scenePos().

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