Setting QStyleOptionComboBox.currentText does not have any effect on the drawn widget

时光毁灭记忆、已成空白 提交于 2019-12-05 09:38:37

It seems you also need to force Qt to draw the combo box label, in addition to the complex control. Try this:

QApplication::style()->drawControl(QStyle::CE_ComboBoxLabel, &comboBoxOption, painter)

If I read the documentation, and source, correctly that might force QStyle to draw a combo box label. It seems odd that you'd have to specify both...but I don't know a whole lot about how Qt styles draw themselves, to be honest.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!