QHoverEvent Class
QHoverEvent 클래스에는 마우스 이벤트를 설명하는 매개변수가 포함되어 있습니다. 더 보기...
Header: | #include <QHoverEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
상속합니다: | QSinglePointEvent |
- 상속된 멤버를 포함한 모든 멤버 목록
- 사용되지 않는 멤버
- QHoverEvent는 이벤트 클래스의 일부입니다.
공용 함수
QHoverEvent(QEvent::Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()) | |
QPoint | oldPos() const |
QPointF | oldPosF() const |
상세 설명
마우스 이벤트는 마우스 커서가 위젯 내부, 외부 또는 위젯 내에서 이동하고 위젯에 Qt::WA_Hover 속성이 있는 경우 발생합니다.
pos() 함수는 현재 커서 위치를 제공하고 oldPos() 함수는 이전 마우스 위치를 제공합니다.
QEvent::HoverEnter 와 QEvent::HoverLeave 이벤트와 QEvent::Enter 와 QEvent::Leave 이벤트 사이에는 몇 가지 유사점이 있습니다. 그러나 HoverEnter와 HoverLeave의 이벤트 핸들러에서 update() 를 수행하기 때문에 약간 다릅니다.
QEvent::HoverMove 도 QEvent::MouseMove 과 약간 다릅니다. 마우스 추적이 활성화된 상태에서 자식 B를 포함하는 최상위 창 A에 자식 C가 있다고 가정해 보겠습니다(모두 마우스 추적이 활성화된 상태):
이제 커서를 A 가운데의 상단에서 하단으로 이동하면 다음과 같은 QEvent::MouseMove 이벤트가 발생합니다:
- A::MouseMove
- B::MouseMove
- C::MouseMove
QEvent::HoverMove 에 대해서도 동일한 이벤트를 얻을 수 있지만 이벤트가 수락 여부에 관계없이 항상 최상위 레벨로 전파된다는 점이 다릅니다. Qt::WA_NoMousePropagation 속성이 있는 경우에만 전파가 중지됩니다.
이 경우 이벤트는 다음과 같은 방식으로 발생합니다:
- A::HoverMove
- A::HoverMove, B::HoverMove
- A::HoverMove, B::HoverMove, C::HoverMove
멤버 함수 문서
QHoverEvent::QHoverEvent(QEvent::Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QPointingDevice *device = QPointingDevice::primaryPointingDevice())
device 에서 시작된 호버 이벤트 객체를 생성합니다.
type 매개변수는 QEvent::HoverEnter, QEvent::HoverLeave, 또는 QEvent::HoverMove 여야 합니다.
scenePos 은 수신 창 또는 장면에 대한 현재 마우스 커서의 상대적 위치, oldPos 은 이전 위치, globalPos 은 절대 좌표의 마우스 위치입니다. modifiers 은 이벤트 당시의 모든 키보드 수정자의 상태를 유지합니다.
QPoint QHoverEvent::oldPos() const
이벤트를 수신한 위젯을 기준으로 마우스 커서의 이전 위치를 반환합니다. 이전 위치가 없는 경우 oldPos()는 pos()와 동일한 위치를 반환합니다.
QEvent::HoverEnter 이벤트에서 이 위치는 항상 QPoint(-1, -1)입니다.
pos()도 참조하세요 .
QPointF QHoverEvent::oldPosF() const
이벤트를 수신한 위젯을 기준으로 마우스 커서의 이전 위치를 반환합니다. 이전 위치가 없는 경우 oldPosF()는 posF()와 동일한 위치를 반환합니다.
QEvent::HoverEnter 이벤트에서 이 위치는 항상 QPointF(-1, -1)입니다.
posF()도 참조하세요 .
© 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.