[PySide] how to change font of single item in QComboBox

Frank Rueter | OHUfx frank at ohufx.com
Thu Jul 26 23:36:40 CEST 2012


that's exactly what I tried but it doesn't do anything for me (osx, 
PySide 1.0.9)
this is my test:

import sys
from PySide.QtGui import *
from PySide.QtCore import *

app = QApplication([])

comboBox = QComboBox()
myFont = QFont("myFontFamily",italic=True)
comboBox.addItems(['testA', 'testB'])
comboBox.setItemData(0, myFont, Qt.FontRole)

comboBox.show()
sys.exit(app.exec_())



On 26/07/12 8:09 PM, Sebastian Elner wrote:
> Hi,
>
> have you tried:
>
> myFont=QFont("myFontFamily",italic=True)
> comboBox.setItemData(0, myFont, Qt.FontRole)
>
> Cheers
>
> Sebastian
>
>
> On 07/26/2012 07:42 AM, Frank Rueter | OHUfx wrote:
>> Hi all,
>>
>> I'm trying to make the first item in my QComboBox italic but can't
>> figure out how.
>> Any ideas out there?
>>
>> Cheers,
>> frank
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside
>




More information about the PySide mailing list