且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

隐藏 QComboBox 标签中的图标

更新时间:2023-11-13 12:38:46

***的方法是设置一个委托并自己绘制项目.然后您可以选择何时或不绘制图标(decorationRole),您可以选择不为当前索引的索引绘制图标.我可以找到一个关于如何在组合框上使用委托的快速示例:http://programmingexamples.net/wiki/Qt/Delegates/ComboBoxDelegate

The best way is to set a delegate and to draw the items yourself. Then you can choose when or not to draw the icon ( decorationRole ), you can choose not to draw the icon for the index which is the current index. I could find a quick example on how to use a delegate on combobox: http://programmingexamples.net/wiki/Qt/Delegates/ComboBoxDelegate

但恐怕这不是最简单的方法.祝你好运!

But I am afraid it is not the most easist of the ways. Good luck!