如何更改组合框 PyQt4 中第一项的字体大小 [英] How to change font size of first item in Combo Box PyQt4
本文介绍了如何更改组合框 PyQt4 中第一项的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改组合框中显示项目的字体.当组合框显示所有不同的选项时,它们是我想要的字体大小 (20).然而,实际菜单上项目的字体大小仍然很小.
How do I change the font of the displayed item in the Combo Box. When the Combo Box displays all the different options, they are the font size I want (20). However the font size of the item on the actual menu is still small.
for dev in devices:
adding = dev[0]
item = QtGui.QStandardItem(str(adding))
font = item.font()
font.setPointSize(20)
item.setFont(font)
model.appendRow(item)
comboBox.move(70, 150)
推荐答案
模型只处理弹窗,必须使用QComboBox
的源码:
the model only handles the popup, you must use the source of the QComboBox
:
font = comboBox.font()
font.setPointSize(20)
comboBox.setFont(font)
这篇关于如何更改组合框 PyQt4 中第一项的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文