QGraphicsSceneEvent Class
QGraphicsSceneEvent 클래스는 모든 그래픽 보기 관련 이벤트에 대한 기본 클래스를 제공합니다. 더 보기...
Header: | #include <QGraphicsSceneEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
상속합니다: | QEvent |
상속받는 사람: | QGraphicsSceneContextMenuEvent, QGraphicsSceneDragDropEvent, QGraphicsSceneHelpEvent, QGraphicsSceneHoverEvent, QGraphicsSceneMouseEvent, QGraphicsSceneMoveEvent, QGraphicsSceneResizeEvent, 그리고 QGraphicsSceneWheelEvent |
공용 함수
virtual | ~QGraphicsSceneEvent() |
(since 6.2) quint64 | timestamp() const |
QWidget * | widget() const |
상세 설명
QGraphicsView 는 Qt 마우스, 키보드, 드래그 앤 드롭 이벤트(QMouseEvent, QKeyEvent, QDragEvent 등)를 받으면 이를 QGraphicsSceneEvent 서브클래스의 인스턴스로 변환하여 표시되는 QGraphicsScene 로 전달합니다. 그러면 씬은 이벤트를 관련 항목으로 전달합니다.
예를 들어, QGraphicsView 가 사용자 클릭에 대한 응답으로 MousePress 유형의 QMouseEvent 을 수신하면 뷰는 mousePressEvent() 함수를 통해 GraphicsSceneMousePress 유형의 QGraphicsSceneMouseEvent 을 기본 QGraphicsScene 으로 보냅니다. 기본 QGraphicsScene::mousePressEvent() 구현은 클릭된 항목을 결정하고 이벤트를 QGraphicsItem::mousePressEvent()로 전달합니다.
QGraphicsSceneMouseEvent 및 QGraphicsSceneContextMenuEvent 같은 서브클래스는 원본 QEvent 의 좌표를 화면, 장면 및 항목 좌표로 제공합니다( screenPos(), scenePos() 및 pos() 참조). 항목 좌표는 이벤트를 QGraphicsItem 으로 전달하기 전에 QGraphicsScene 에서 설정합니다. 마우스 이벤트는 또한 뷰가 수신한 마지막 이벤트에서 좌표를 검색할 수 있는 기능을 추가합니다( lastScreenPos(), lastScenePos() 및 lastPos() 참조).
QEvent도 참조하십시오 .
멤버 함수 문서
[virtual noexcept]
QGraphicsSceneEvent::~QGraphicsSceneEvent()
이벤트를 삭제합니다.
[since 6.2]
quint64 QGraphicsSceneEvent::timestamp() const
원래 이벤트의 타임스탬프를 반환하거나, 원래 이벤트가 타임스탬프를 보고하지 않는 경우 0을 반환합니다.
이 함수는 Qt 6.2에 도입되었습니다.
QWidget *QGraphicsSceneEvent::widget() const
이벤트가 발생한 위젯을 반환하거나, 다른 애플리케이션에서 발생한 이벤트인 경우 nullptr
을 반환합니다.
© 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.