QContextMenuEvent Class
QContextMenuEvent 클래스에는 컨텍스트 메뉴 이벤트를 설명하는 매개 변수가 포함되어 있습니다. 더 보기...
Header: | #include <QContextMenuEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
상속합니다: | QInputEvent |
- 상속된 멤버를 포함한 모든 멤버 목록
- 사용되지 않는 멤버
- QContextMenuEvent는 이벤트 클래스의 일부입니다.
공용 형
enum | Reason { Mouse, Keyboard, Other } |
공용 함수
QContextMenuEvent(QContextMenuEvent::Reason reason, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier) | |
const QPoint & | globalPos() const |
int | globalX() const |
int | globalY() const |
const QPoint & | pos() const |
QContextMenuEvent::Reason | reason() const |
int | x() const |
int | y() const |
상세 설명
컨텍스트 메뉴 이벤트는 사용자가 컨텍스트 메뉴 열기와 관련된 동작을 수행할 때 위젯으로 전송됩니다. 컨텍스트 메뉴를 여는 데 필요한 동작은 플랫폼마다 다르며, 예를 들어 Windows에서는 메뉴 버튼을 누르거나 마우스 오른쪽 버튼을 클릭하면 이 이벤트가 전송됩니다.
이 이벤트가 발생하면 컨텍스트와 관련된 경우 컨텍스트 메뉴와 함께 QMenu 를 표시하는 것이 일반적입니다.
회원 유형 문서
enum QContextMenuEvent::Reason
이 열거형은 이벤트가 전송된 이유를 설명합니다.
Constant | 값 | 설명 |
---|---|---|
QContextMenuEvent::Mouse | 0 | 마우스로 인해 이벤트가 전송되었습니다. 일반적으로 마우스 오른쪽 버튼이 클릭되었음을 의미하지만 플랫폼에 따라 다릅니다. |
QContextMenuEvent::Keyboard | 1 | 키보드로 인해 이벤트가 전송되었습니다. Windows에서는 메뉴 버튼을 눌렀음을 의미합니다. |
QContextMenuEvent::Other | 2 | 마우스나 키보드가 아닌 다른 수단을 통해 이벤트가 전송되었습니다. |
멤버 함수 문서
QContextMenuEvent::QContextMenuEvent(QContextMenuEvent::Reason reason, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier)
accept 매개변수 플래그가 false로 설정된 컨텍스트 메뉴 이벤트 객체를 생성합니다.
reason 매개변수는 QContextMenuEvent::Mouse 또는 QContextMenuEvent::Keyboard 여야 합니다.
pos 매개변수는 수신 위젯을 기준으로 마우스 위치를 지정합니다. globalPos 은 절대 좌표의 마우스 위치입니다. modifiers 는 키보드 수정자를 포함합니다.
const QPoint &QContextMenuEvent::globalPos() const
이벤트 발생 시 마우스 포인터의 전역 위치를 반환합니다.
int QContextMenuEvent::globalX() const
이벤트 발생 시 마우스 포인터의 전역 x 위치를 반환합니다.
globalY() 및 globalPos()도 참조하세요 .
int QContextMenuEvent::globalY() const
이벤트 발생 시 마우스 포인터의 전역 y 위치를 반환합니다.
globalX() 및 globalPos()도 참조하세요 .
const QPoint &QContextMenuEvent::pos() const
이벤트를 수신한 위젯을 기준으로 마우스 포인터의 위치를 반환합니다.
x(), y() 및 globalPos()도 참조하세요 .
QContextMenuEvent::Reason QContextMenuEvent::reason() const
이 컨텍스트 이벤트의 이유를 반환합니다.
int QContextMenuEvent::x() const
이벤트를 수신한 위젯을 기준으로 마우스 포인터의 x 위치를 반환합니다.
int QContextMenuEvent::y() const
이벤트를 수신한 위젯을 기준으로 마우스 포인터의 y 위치를 반환합니다.
© 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.