Search code examples
pythonpython-2.7pyqtpyqt4qcombobox

How to change font size of first item in Combo Box PyQt4


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)

Solution

  • the model only handles the popup, you must use the source of the QComboBox:

    font = comboBox.font()
    font.setPointSize(20)
    comboBox.setFont(font)