Qt World Summit: Register Today!

Set the color for the cell with the widget in QWidgetTable

  • There is a program in PyQt.
    There is an QTableWidget in which an item is added in this way:
    self.pTableWidget = QtGui.QTableWidget
    self.pTableWidget.setItem(i, j, QtGui.QTableWidgetItem("text"))

    and sets the color of this item

    self.pTableWidget.item(i, j).setBackground(QtGui.QBrush(QtGui.QColor("#ccc")))

    also to the table added widget:

    self.pTableWidget.setCellWidget(i, j, widget)

    Q: how to set the color of the cell in which is placed the widget?

Log in to reply