python - PyQt: reset or remove the background color from QTreeWidgetItem -


how remove background color of qtreewidgetitem, or reset default?

treewidgetitem.setbackgroundcolor(0, qtgui.qcolor('green')) 

you can background colour this:

treewidgetitem.background(0) 

returning like:

<pyside.qtgui.qbrush(qcolor(argb 1, 0, 0, 0) , nobrush )   @ 0x00000000eb1f6588> 

now put string before apply change , you've got answer.

originalbg = treewidgetitem.background(0)  # new background treewidgetitem.setbackgroundcolor(0, qtgui.qcolor('green'))  # old background treewidgetitem.setbackgroundcolor(0, originalbg) 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -