c++ - 如何禁用 QToolBar 中的扩展按钮?
问题描述
我想知道如何禁用QToolBar中的扩展按钮,它显示为工具栏中的最后一项,当工具栏太小而无法显示所有项目时?我已经尝试通过 find child 方法,但这不起作用。
解决方案
If you want to hide the button that allows you to expand the QToolBar you must first obtain it using the objectName "qt_toolbar_ext_button", and to hide it you must set to size 0, 0 since the hide() method will fail:
if(QToolButton *button = toolbar->findChild<QToolButton *>("qt_toolbar_ext_button")){
button->setFixedSize(0, 0);
// button->setEnabled(false);
}
推荐阅读
- javascript - 捕获并更改 url 请求以进行删除
- node.js - 在nodejs中监听https流量
- c# - Appium 在真实设备上启动但 chrome 挂起
- spring-boot - 警告:未加载 JDBC 驱动程序,因为 driverClassName 属性为空,在 springboot 中使用两个数据源
- prolog - 带有 if - plus 和 minus 的列表
- ios - 我可以选择让 iPhone 用户升级/更新 iOS 应用程序吗?
- java - 如何部署 webService 并访问 wsdl?
- visual-studio - 生成 Visual Studio 项目文件以构建具有 qmake 语法的库以及在哪里可以找到项目文件?
- java - .setText using SharedPreferences doesnt work
- python - 使用 SWIG 绑定 Python/C++ 模板