QStyleOptionMenuItemV2 Class
QStyleOptionMenuItemV2 类通过新增成员扩展了QStyleOptionMenuItem 的功能。更多内容...
| 头文件: | #include <QStyleOptionMenuItemV2> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 自: | Qt 6.11 |
| 继承自: | QStyleOptionMenuItem |
公共函数
| QStyleOptionMenuItemV2() | |
| QStyleOptionMenuItemV2(const QStyleOptionMenuItemV2 &other) | |
| QStyleOptionMenuItemV2 & | operator=(const QStyleOptionMenuItemV2 &) |
公共变量
| bool | mouseDown |
成员函数文档
QStyleOptionMenuItemV2::QStyleOptionMenuItemV2()
构建一个 QStyleOptionMenuItemV2,并将成员变量初始化为默认值。
QStyleOptionMenuItemV2::QStyleOptionMenuItemV2(const QStyleOptionMenuItemV2 &other)
创建other 样式选项的副本。
[noexcept default] QStyleOptionMenuItemV2 &QStyleOptionMenuItemV2::operator=(const QStyleOptionMenuItemV2 &)
将other 复制并赋值给此QStyleOptionMenuItemV2 实例。
成员变量文档
bool QStyleOptionMenuItemV2::mouseDown
当鼠标被按下时为 true。
之所以需要这样做,是因为当设置了QStyle::State_Sunken 时,系统无法区分按键的“按下”状态和“下沉”状态。当菜单打开时(即显示弹出菜单时),也会设置QStyle::State_Sunken 。
© 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.