JokerMartini JokerMartini - 2 months ago 29
Python Question

Pyside setData flags on QStandardItem

I have two questions here.


  1. Where can I find a list of all the available flags/properties I can set using the setData method of a QstandardItem? I only know of the one below because i came across it online.

  2. How do I set the Font of my QStandardItem to be bold?



Python

doors = QtGui.QStandardItem("Doors")

doors.setData(QtGui.QBrush(QtGui.QColor(200, 10, 255, 255)), role=QtCore.Qt.ForegroundRole)

Answer
  1. The Qt Documentation lists the item data roles.

  2. The font can be changed like this:

    font = item.font()
    font.setBold(True)
    item.setFont(font)