QGraphicsSceneDragDropEvent Class
QGraphicsSceneDragDropEvent 클래스는 그래픽 뷰 프레임워크에서 끌어서 놓기를 위한 이벤트를 제공합니다. 더 보기...
Header: | #include <QGraphicsSceneDragDropEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
상속합니다: | QGraphicsSceneEvent |
공용 함수
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 |
자세한 설명
QGraphicsView 에서 제공하는 드래그 앤 드롭 기능을 상속합니다 QWidget. 드래그 앤 드롭 이벤트를 받으면 QGraphicsSceneDragDropEvent로 변환합니다.
QGraphicsSceneDragDropEvent는 GraphicsSceneDragEnter, GraphicsSceneDragLeave, GraphicsSceneDragMove, GraphicsSceneDrop 타입의 이벤트를 저장합니다.
QGraphicsSceneDragDropEvent에는 항목, 장면 및 화면 좌표에서 마우스 커서의 위치가 모두 포함되어 있으며 pos(), scenePos() 및 screenPos()로 검색할 수 있습니다.
씬은 마우스 커서 아래의 첫 번째 QGraphicsItem 로 이벤트를 전송하여 드롭을 허용하고, 그래픽 항목은 setAcceptDrops()로 드롭을 허용하도록 설정합니다.
멤버 함수 문서
[virtual noexcept]
QGraphicsSceneDragDropEvent::~QGraphicsSceneDragDropEvent()
개체를 파괴합니다.
void QGraphicsSceneDragDropEvent::acceptProposedAction()
제안된 작업을 수락된 작업으로 설정합니다. 즉, 드롭 작업이 제안된 작업으로 설정됩니다. 이는 다음과 같습니다:
setDropAction(proposedAction());
이 함수를 사용할 때는 accept()
을 호출해서는 안 됩니다.
dropAction(), setDropAction() 및 proposedAction()도 참조하세요 .
Qt::MouseButtons QGraphicsSceneDragDropEvent::buttons() const
이 마우스 이벤트가 생성될 때 마우스에서 어떤 버튼을 눌렀는지를 나타내는 Qt::MouseButtons 값을 반환합니다.
Qt::MouseButtons도 참조하세요 .
Qt::DropAction QGraphicsSceneDragDropEvent::dropAction() const
이 드래그 앤 드롭에서 수행된 작업을 반환합니다. 이 값은 끌어서 놓기 수신자가 설정해야 하며 QDrag::exec()에서 반환합니다.
setDropAction() 및 acceptProposedAction()도 참조하세요 .
const QMimeData *QGraphicsSceneDragDropEvent::mimeData() const
이 함수는 이벤트의 MIME 데이터를 반환합니다.
Qt::KeyboardModifiers QGraphicsSceneDragDropEvent::modifiers() const
끌어서 놓기 이벤트가 생성될 때 눌렀던 키보드 수정자를 반환합니다.
Qt::KeyboardModifiers 를참조하세요 .
QPointF QGraphicsSceneDragDropEvent::pos() const
이벤트를 전송한 뷰를 기준으로 이벤트의 마우스 위치를 반환합니다.
QGraphicsView, screenPos() 및 scenePos()도 참조하세요 .
Qt::DropActions QGraphicsSceneDragDropEvent::possibleActions() const
끌어서 놓기로 인해 발생할 수 있는 드롭 동작을 반환합니다.
Qt::DropActions도 참조하세요 .
Qt::DropAction QGraphicsSceneDragDropEvent::proposedAction() const
제안된 드롭 액션, 즉 선호되는 액션을 반환합니다. 액션은 possibleActions()
에 정의된 가능한 액션 중 하나이어야 합니다.
Qt::DropAction 및 possibleActions()도 참조하세요 .
QPointF QGraphicsSceneDragDropEvent::scenePos() const
마우스 위치를 장면 좌표로 반환합니다.
QPoint QGraphicsSceneDragDropEvent::screenPos() const
화면을 기준으로 한 마우스 위치를 반환합니다.
void QGraphicsSceneDragDropEvent::setDropAction(Qt::DropAction action)
possible actions이 함수를 사용하면 드롭 수신자가 수행한 드롭 동작을 action 으로 설정할 수 있습니다. 이 함수를 사용하는 경우 acceptProposedAction()
대신 accept()
을 호출하세요.
dropAction(), accept() 및 possibleActions()도 참조하세요 .
QWidget *QGraphicsSceneDragDropEvent::source() const
이 함수는 QGraphicsSceneDragDropEvent 을 생성한 QGraphicsView 을 반환합니다.
© 2025 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.