Utils::OptionPushButton Class
class Utils::OptionPushButtonOptionPushButton 类实现了QPushButton 接口,只有当用户点击菜单指示器时,该菜单才会打开。更多内容...
| Header: | #include <OptionPushButton> |
公共函数
| OptionPushButton(QWidget *parent = nullptr) | |
| OptionPushButton(const QString &text, QWidget *parent = nullptr) | |
| void | setOptionalMenu(QMenu *menu) |
详细说明
使用OptionPushButton::setOptionalMenu() 设置菜单及其操作。如果用户单击按钮的菜单指示符,则会打开该菜单,并在用户选择相应操作时触发这些操作。
如果用户点击按钮上的其他任何位置,则会发送QAbstractButton::clicked()信号,就好像该按钮没有菜单一样。
注意:请勿调用QPushButton::setMenu()。请改用OptionPushButton::setOptionalMenu()。
成员函数文档
OptionPushButton::OptionPushButton(QWidget *parent = nullptr)
创建一个选项按钮,其父容器为parent 。
OptionPushButton::OptionPushButton(const QString &text, QWidget *parent = nullptr)
创建一个选项按钮,其文本为“text ”,父级为“parent ”。
void OptionPushButton::setOptionalMenu(QMenu *menu)
将下拉菜单menu 与该按钮关联。当用户点击显示的菜单指示符时,将显示此菜单。如果用户点击按钮上的其他位置,则会发送QAbstractButton::clicked()事件。
注意:调用 此方法将移除与QAbstractButton::pressed() 信号的所有连接。
菜单的所有权不会转移给该按钮。
Copyright © The Qt Company Ltd. and other contributors. 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.