QGraphicsSceneDragDropEvent Class
La classe QGraphicsSceneDragDropEvent fornisce eventi relativi al trascinamento e al rilascio nel framework delle viste grafiche. Per saperne di più...
| Intestazione: | #include <QGraphicsSceneDragDropEvent> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| Eredita da: | QGraphicsSceneEvent |
Funzioni pubbliche
| virtual | ~QGraphicsSceneDragDropEvent() |
| void | acceptProposedAction() |
| Qt::MouseButtons | buttons() const |
| Qt::DropAction | dropAction() const |
| const QMimeData * | mimeData() const |
| Qt::KeyboardModifiers | modifiers() const |
| QPointF | pos() const |
| Qt::DropActions | possibleActions() const |
| Qt::DropAction | proposedAction() const |
| QPointF | scenePos() const |
| QPoint | screenPos() const |
| void | setDropAction(Qt::DropAction action) |
| QWidget * | source() const |
Descrizione dettagliata
QGraphicsView Eredita la funzionalità di trascinamento fornita da QWidget. Quando riceve un evento di trascinamento, lo converte in un QGraphicsSceneDragDropEvent.
QGraphicsSceneDragDropEvent memorizza eventi di tipo GraphicsSceneDragEnter, GraphicsSceneDragLeave, GraphicsSceneDragMove o GraphicsSceneDrop.
QGraphicsSceneDragDropEvent contiene la posizione del cursore del mouse sia nelle coordinate dell’elemento, sia in quelle della scena e dello schermo; questa può essere recuperata con pos(), scenePos() e screenPos().
La scena invia l’evento al primo elemento QGraphicsItem sotto il cursore del mouse che accetta il rilascio; un elemento grafico viene impostato per accettare il rilascio tramite setAcceptDrops().
Documentazione delle funzioni membro
[virtual noexcept] QGraphicsSceneDragDropEvent::~QGraphicsSceneDragDropEvent()
Distrugge l'oggetto.
void QGraphicsSceneDragDropEvent::acceptProposedAction()
Imposta l'azione proposta come accettata, ovvero l'azione "drop" viene impostata come azione proposta. Ciò equivale a:
setDropAction(proposedAction());Quando si utilizza questa funzione, non si deve chiamare ` accept()`.
Vedi anche dropAction(), setDropAction() e proposedAction().
Qt::MouseButtons QGraphicsSceneDragDropEvent::buttons() const
Restituisce un valore di tipo ` Qt::MouseButtons ` che indica quali pulsanti del mouse sono stati premuti al momento della generazione di questo evento del mouse.
Vedi anche Qt::MouseButtons.
Qt::DropAction QGraphicsSceneDragDropEvent::dropAction() const
Restituisce l'azione eseguita in questa operazione di trascinamento e rilascio. Questo valore dovrebbe essere impostato dal destinatario del rilascio e viene restituito dalla funzione QDrag::exec().
Vedi anche setDropAction() e acceptProposedAction().
const QMimeData *QGraphicsSceneDragDropEvent::mimeData() const
Questa funzione restituisce i dati MIME dell'evento.
Qt::KeyboardModifiers QGraphicsSceneDragDropEvent::modifiers() const
Restituisce i modificatori della tastiera che erano stati premuti al momento della generazione dell'evento "trascina e rilascia".
Vedi anche Qt::KeyboardModifiers.
QPointF QGraphicsSceneDragDropEvent::pos() const
Restituisce la posizione del mouse dell'evento rispetto alla vista che ha inviato l'evento.
Vedi anche QGraphicsView, screenPos() e scenePos().
Qt::DropActions QGraphicsSceneDragDropEvent::possibleActions() const
Restituisce le possibili azioni di rilascio che possono derivare dall'operazione di trascinamento e rilascio.
Vedi anche Qt::DropActions.
Qt::DropAction QGraphicsSceneDragDropEvent::proposedAction() const
Restituisce l'azione di rilascio proposta, ovvero quella preferita. L'azione deve essere una delle azioni possibili definite all'indirizzo possibleActions().
Vedi anche Qt::DropAction e possibleActions().
QPointF QGraphicsSceneDragDropEvent::scenePos() const
Restituisce la posizione del mouse nelle coordinate della scena.
Vedi anche pos() e screenPos().
QPoint QGraphicsSceneDragDropEvent::screenPos() const
Restituisce la posizione del mouse rispetto allo schermo.
Vedi anche pos() e scenePos().
void QGraphicsSceneDragDropEvent::setDropAction(Qt::DropAction action)
Questa funzione consente al destinatario del drop di impostare l'azione di drop eseguita su action, che deve essere una delle opzioni presenti su possible actions. Se si utilizza questa funzione, chiamare accept() anziché acceptProposedAction().
Vedi anche dropAction(), accept() e possibleActions().
QWidget *QGraphicsSceneDragDropEvent::source() const
Questa funzione restituisce l'QGraphicsView che ha creato l'QGraphicsSceneDragDropEvent.
© 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.