python - How to setStyleSheet to QStandardItem -


the code below creates simple qcombobox. instead of using "traditional" .additem('myitemname') method creates qstandarditem first , adds via qcombobox's .model().appendrow(). since can access each qstandarditem individually wonder if there way assign css each of them (to each qstandarditem) individually. goal customize each item displayed in combobox pulldown menu. far able assign single css style entire combobox globally.

from pyqt4 import qtcore, qtgui app = qtgui.qapplication([])  class combo(qtgui.qcombobox):     def __init__(self, *args, **kwargs):         super(combo, self).__init__()                 each in ['item_1','item_2','item_3','item_4','item_5']:             item=qtgui.qstandarditem(each)              self.model().appendrow(item)  tree=combo() sys.exit(app.exec_()) 

it looks class has no setstylesheet method, can use setbackground, setforeground , settextalignment methods. qbrush able customize elements. of course isn't powerful stylesheets better nothing.

http://pyqt.sourceforge.net/docs/pyqt4/qstandarditem.html


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

django - CSRF verification failed. Request aborted. CSRF cookie not set -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -