이 페이지에서

QGraphicsSceneEvent Class

QGraphicsSceneEvent 클래스는 모든 그래픽 뷰 관련 이벤트에 대한 기본 클래스를 제공합니다. 더 보기...

헤더: #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() 참조). 항목 좌표는 QGraphicsScene 가 이벤트를 QGraphicsItem 로 전달하기 전에 설정됩니다. 또한 마우스 이벤트를 통해 뷰가 마지막으로 수신한 이벤트의 좌표를 가져올 수도 있습니다( lastScreenPos(), lastScenePos(), lastPos() 참조).

QEvent도 참조하십시오 .

멤버 함수 문서

[virtual noexcept] QGraphicsSceneEvent::~QGraphicsSceneEvent()

이벤트를 삭제합니다.

[since 6.2] quint64 QGraphicsSceneEvent::timestamp() const

원본 이벤트의 타임스탬프를 반환하며, 원본 이벤트에 타임스탬프가 보고되지 않은 경우 0을 반환합니다.

이 함수는 Qt 6.2에서 도입되었습니다.

QWidget *QGraphicsSceneEvent::widget() const

이벤트가 발생한 위젯을 반환하거나, 이벤트가 다른 애플리케이션에서 발생한 경우 ` nullptr `를 반환합니다.

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