Hello!

There are different ways to do this! I do not use this very often, and there are probably better ways then in the code below... Using 'setStyleSheet()' is possible for all widgets, but it often makes widgets looking 'old style', at least on my system. Using setPalette() seems much better for me, you can test both possibilities with the code below:


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

app = QApplication(sys.argv)
model = QFileSystemModel()
model.setRootPath(QDir.currentPath())
tree =  QTreeView()
tree.setModel(model)
red = QBrush(Qt.red)
green = QBrush(Qt.green)
tree.setPalette(QPalette(red, red, red, red, red, green, green, red, red))
# tree.setStyleSheet("background-color:red")
tree.show()

sys.exit(app.exec_())



_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to