QTableWidget set the Background of header Cell

  • I know how to set the Horizontal Headers background color, but how can i set the Headers Background Color for a specified Row? In this example, say i want to have the Header Row with the Label "3" to be red?

    Example what i get now
    link text

    import sys
    from PyQt4 import QtCore, QtGui
    from PyQt4.QtGui import *
    class Example(QtGui.QWidget):
        def __init__(self):
            super(Example, self).__init__()
        def initUI(self):
            self.setGeometry(300, 300, 250, 150)
            self.rigTable = QTableWidget(1, 3, self)
            style = "::section {""background-color: lightblue; }"
            self.rigTable.setCellWidget(0, 0, QLabel("A"))
            self.rigTable.setCellWidget(0, 1,  QLabel("B"))      
    def main():
        app = QtGui.QApplication(sys.argv)
        ex = Example()
    if __name__ == '__main__':

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.