Pyqt qtablewidget header background color. 'Status' records comprises of 'YES' or 'NO' .

'Status' records comprises of 'YES' or 'NO' . row = table. 通过上述示例,我们了解了如何在PyQt中更改QTableWidget特定单元格的背景颜色。. But it does not always work as expected. From there you can use the methods for QTableWidgetItem such as setBackgroundColor to change the background. from PyQt4 import QtCore, QtGui. Jan 19, 2017 · 0. thEClaw. ansTable->setStyleSheet ("QToolTip {border: 2px solid orange; padding: 5px; border-radius: 3px; opacity: 200;}"); where ui. Nov 2, 2018 · formatting a QTableView header. 4 rows and 4 columns . The QHeaderView class is one of the Model/View Classes and Mar 26, 2020 · In order to change the color of the main window we use setStylesheet() method. I have resolved my problem with : ui->tableWidget->item (i,j)->setBackground (Qt::gray); 0. QFont() afont. Here's an example. The default value is true. The border should be set Jun 13, 2014 · You can use self. class Window(QMainWindow): Dec 18, 2012 · QTableWidget has a signal itemChanged that needs to be connected to a slot. g. Setting the style of the vertical header setTextAlignment takes an int for the argument (alignment). May 2, 2019 · Here's what worked and what didn't (again, for me). Formated image: I do not wish to formate the headers. However most of the times the background will be ignored because the actual QStyle will override it. The following table lists the Qt widgets that can be customized using style sheets: Widget. You can subclass the QSqlQueryModel to redefine data() to return your calculated color, or if you have Qt > 4. I want to change the fourth row/column grid line's color to yellow (or other highlight colors) to make the 3*3 part highlighted. I'm trying to customize appearance of header for my QTableWidget using stylesheet. Jan 10, 2012 · Or when you're starting to search change color for QPalette::Highlight on the table widget to red and 'select' item using setCurrentIndex(). The HeaderView doesn't accept delegates like the QTreeView does; it does all the painting itself. I figured out I could do this by making a stylesheet and setting it to my table widget, like so. If not using delegates and one doesn't want to set alignment for every QTableWidgetItem created anew, then you could set the prototype item in the table widget like so. It moves the scroll bar only to the beginning of the last row inserted which is not always necessarily the bottom of the table because sometimes the height of the last row inserted is really large. tableWidget_2. 3,526 3 43 62. backgroundRole(), Qt. Dec 18, 2013 · How do I get the background color of this button to change. If you want to use an arbitrary background color, you need to modify the widget's palette instead: p = w. This means that every widget whose mandatoryField Qt property is set to true would have a yellow background. – OnWhenReady. tableWidget->horizontalHeader()->setFont(font); How can I change the font in this case? . Dec 13, 2019 · How to change Qtablewidget's specific cells background color in pyqt. Once connected to a slot the signal will pass in the QTableWidgetItem that has been changed. Sep 8, 2011 · I am trying to change the background color for certain header sections. 7. 13 on Windows, setting a background-color on the QTableWidget QTableCornerButton element in the Qt stylesheet has an effect but setting background-image has not. For me the following works: @QHeaderView::section {. Top-level items are constructed without a parent then inserted at the position specified by a pair of row and column numbers: QTableWidgetItem*newItem =newQTableWidgetItem(tr("%1"). – Nishant Kumar. Subclass QStyledItemDelegate. If the selected cells are all in the same row, you could do this ( table refers to the QTableWidget). My Table in database. This property holds the style used when drawing the grid (see showGrid ). verticalHeaderItem(row). The first row of text (the "MAC Address Serial Number Device Name" is the header data (set in the model). ansTable is a qtablewidget. : To change the color of each Item of the header, it is possible to set each individual QTableWidgetItem. The QTableWidget class allows you to create a table widget that displays the tabular form of items. However, Everything is working fine expect the QTableWidget Headers. 8, you can use a QIdentityProxyModel: 总结. However, the background on the right Oct 19, 2016 · I'm able to change the background color of both header other than one cell. All derivatives of QAbstractScrollArea, including QTextEdit, and QAbstractItemView (all item view classes), support scrollable backgrounds using background-attachment. setColor(w. For more information, see the documentation for the setAutoFillBackground property. argv) class TableModel(QtCore. No model added. I have tried using Palette and I am having no success. As it IGHOR said you can use data() method in your model and provide a color when role is Qt::BackgroundColor. setStyleSheet('background-color: red') This issue happens whenever a stylesheet is applied to a custom widget or to one of its ancestor widgets. Apr 14, 2019 · To set the whole of a QTreeView Background Colour this works for me: IG = QTreeView() IG. T. QBrush(purple)) header3 = widget. Apr 18, 2018 · You need to call setAutoFillBackground(True) on the widget. You can probably give the sections differing colors, or make them alternating if you want. app=QtGui. I already know how to change all the headers together, using: ui->tableWidget->setStyleSheet("QHeaderView::section {background-color:red}"); But I need to change the items individually. Nov 5, 2020 · QTableCornerButton is a private class of QTableWidget, you can enable and disable the button using the function QTableView::setCornerButtonEnabled, however, if you disable the button, that corner abstract button has a white background. Jul 29, 2015 · This model changes the foreground & background colors of some cells based on the displayed values. 6. You should check Qt Sylesheet Reference. #2. Code: Nov 15, 2022 · PyQt6 QTableWidgetItem Change Background Color if Value Changes. E. 如果需要一次性更改多个单元格的背景色,可以使用循环遍历需要更改背景颜色 Dec 10, 2015 · 1. getText to obtain the new value from the user. setFont(fnt) Mar 23, 2019 · I am working on a Sudoku project, and I used a QTableWidget to create the 9*9 map. I have a QTabWidget with a number of tabs I want to set the background color of each tab in the tabBar differently. format(section + 1) return super(). In your example, create the item before you attempt to set the background color. I'd like to improve this display, and the first thing that comes to mind is to visually set Oct 5, 2012 · 2. __init__(self) Aug 4, 2019 · I have a table widget. This code did nothing to the header: tableView->horizontalHeader()->setStyleSheet("background-color: black;"); This code worked but also changed the border of the whole QTableView Widget: tableView->setStyleSheet("QHeaderView::section {. QAbstractTableModel): def __init__(self): QtCore. headerData(section, orientation, role) Obviously you can set your own labels even with a simple list containing the labels you want to show. The one cell at intersection of two headers (you may call is cell zero of both vertical and horizontal headers). I'm doing this way: background-color: transparent; color: black; font: 10pt "MS Shell Dlg 2"; padding-left: 4px; border: 1px solid #6c6c6c; It looks nice in Qt Designer and in it's preview mode, but when I'm running the program, header is created with default Mar 5, 2013 · All you need to do is this: Get the header item with horizontalHeaderItem(index) and use text to get the value or setText to set the new value. from PyQt5 import QtCore. It is different from QAbstractScrollArea::cornerWidget, you can set another widget with setCornerWidget, but Aug 31, 2012 · 2. The QTableView is the white box near the top. The QTableWidgetItem class is a convenience class that replaces the QTableItem class in Qt 3. edited Dec 4, 2017 at 19:42. This property holds whether the grid is shown. from PyQt5. Jun 16, 2016 · I have QT TableWidget and I would like to change background color of column based on their value. Feb 1, 2018 · QHeaderView::section { background-color: rgb(255, 255, 255); border: none; height: 32px; } Apr 19, 2012 · Finally, set the format by calling the setWeekdayTextFormat method on the QCalendarWidget, passing it the days of the week you wish to change and the format you want to change it to. Here is a minimal example that shows this: import sys. The model is the QAbstractTableModel, and I want to background color say row 0. My current attempt is to subclass the QTableWidgetItem Please check your question. answered Dec 4, 2017 at 19:34. red) widget. setStyleSheet("background-color Introduction to PyQt QTableWidget class. background-color:yellow. setPalette(palette) # add layout and child widgets. I've also tried messing around with isSelected() and changing the background-color of all the items it returns, but still no luck. Seems I can change all columns background doing something like this: tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section {background-color: red}"); But I want to change color for given column and each column color can be different. All the time, I get a 2px grid width or no grid at all. item(1,0). QApplication(sys. replied to fgdevel on 9 Oct 2015, 09:16. The items in the QTableWidget are created using the QTableWidget Item class. It provides an item for use with the QTableWidget class. Jun 18, 2020 · I am new to pyqt. Khoury. First, we would use the following application-wide style sheet: *[mandatoryField="true"] { background-color: yellow } This means that every widget whose mandatoryField Qt property is set to true would have a yellow background. scrollToBottom just after inserting a new item. Oct 9, 2020 · return 'Column {}'. setAutoFillBackground(True) palette = widget. Column headers : Number , Company, Equipment , Status . This because the underlying Qt code does this: return qvariant_cast<QBrush>(data(column Jan 6, 2017 · For me, using PyQt4. setAttribute(QtCore. You should set a class property (etc tableview's currentindex) which can be reset value from outside the class, by this, the delegate's default loop will compare the tableview's currentindex. QFont font; font. Yes it is possible but only with a slight trick. Syntax : setStyleSheet (“background-color: grey;”) Argument : It takes string as an argument. backgroundRole(), QtCore. I have set the selection behavior to select entire row. PyQt简介 PyQt 是一个用于创建图形用户界面(GUI)的工具包,它是基于 Qt 库的 Python 绑定。 Dec 11, 2018 · @Qt-Enthusiast said in how to change the background color of QTableWidgetItem: help me in sample code of how to set grid line color of QtableWidget using setStyleSheet. Oct 3, 2014 · I would like to display a table in Qt with a specific style. I searched for a while and could not find any solution. I would like the color to be red. stylesheet = "::section {border-style: solid; background-color: rgb (158,158,158)}" self. BackgroundRole, None) It's worth noting that when a background has not been set, the background() method will actually return a null QBrush rather than None. Then the Proxy model filters out every third index. 我们可以使用setItem方法设置单元格的内容,并使用setCellBackgroundColor方法设置单元格的背景色。. If you like to color the background of the headerView: tableWidget->verticalHeader ()->setStyleSheet ("QHeaderView::section { background-color:blue }"); – OnWhenReady. After creating a custom QLabel class that opens a QInputDiaglog popup when double clicked to change the value displayed in the cell, I realized that a QTableWidgetItem can be double clicked to edit its value. Notice that using a QTableWidget is not the only path to display information in tables. This code has no impact on the color of the qwidgetitem. Note1: The background-color and padding are unfortunate but they are necessary to make our custom rendering looks like the default one. Let's say my table has 3 columns, but the data they contain is very different, like (for each row) a long sentence Oct 13, 2015 · 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? Dec 19, 2017 · I'd like to have different selection color when an item is selected. setPointSize(40) self. QHeaderView::section{background-color:rgb(120,120,120);color: white;} but i get this Mar 18, 2020 · You can use QTableWidget. header->setStyleSheet ("QHeaderView { font: bold 12px; font-family: microsoft sans serif; color: #5d6d7e Jul 13, 2020 · 前言 窗口背景主要包括,背景色与背景图片,设置窗口背景有三种方法 使用QSS设置窗口背景 使用QPalette设置窗口背景 实现PainEvent,使用QPainter绘制背景 QSS设置窗口背景 在QSS中,我们可以使用Background或者background-color的方式来设置背景色,设置窗口背景色之后 PyQt 设置 QTableWidgetItem 的背景颜色 在本文中,我们将介绍如何使用 PyQt 设置 QTableWidgetItem 的背景颜色。 阅读更多:PyQt 教程 1. Below code does not work, font size remains unchanged. See also background() and setForeground(). #1. setColor(widget. This function was introduced in Qt 4. Thanks a lot! Though an exhaustive one, the above documentation was of good help. I did not use the color of the default header. Jun 11, 2016 · The correct method is to clear the underlying data, like this: treeWidgetItem. tableView->setObjectName("myFrame"); Jan 22, 2018 · Database used is sqlite . setPointSize(7); ui. You have to do something like. WA_StyledBackground, True) self. Example #1: from PyQt5. Nov 26, 2009 · Answering myself, here is what I ended up doing : a delegate. [PyQt] Help: check content of combobox in horizontal header of QTableWidget: mart79: 1: 3,567: Jul-26-2020, 06:18 PM Last Post: deanhystad [PyQt] Add validation (regex) to QTableWidget cells: mart79: 0: 2,916: May-05-2020, 12:51 PM Last Post: mart79 [PyQt] Pyqt5: How do you make a button that adds new row with data to a Qtablewidget Feb 6, 2022 · Solved! Two ways to changed QTableView Row background color when user mouse clicking. tblDinamic. setTabTextColor (index, color) But i want to set the background not the text color. I need a function to change the row Nov 2, 2015 · MyTableView::MyTableView( QWidget* parent ) : QTableView( parent ) {. Jun 29, 2016 · I'm developing a computer application with PySide and I'm using the QTableWidget. Oct 5, 2013 · 8. Access functions: gridStyle() setGridStyle() property showGridᅟ: bool #. Background) # alternatively with QtGui. Depending on the value of section (header index starting at zero) you can individually style the header items. Apr 11, 2017 · self. Explore Teams It turns out this is very easy to implement using Qt Style Sheets. from PyQt4 import QtGui. It takes the place of Qt3's QHeader class previously used for the same purpose, but uses the Qt's model/view architecture for consistency with the item view classes. So is there a way to make every item have individual selection color? Jul 27, 2014 · 2. Jul 16, 2014 · 3. Sets the item's background brush to the specified brush. horizontalHeaderItem(2) purple = QColor(139,103,153) header2. QColor(125,125,125)) It's working, but set background for the row with iterating needs more time if you have more then one table. However, you can make the background-color transparent (rgba(0,0,0,0)) and then you see the background image of the widget shining through. Use QStyledItemDelegate. // QPalette::Background is obsolete, use QPalette::Window. fgdevel. tableWidget->setItem(8, 0, new QTableWidgetItem); tableWidget->item(8, 0)->setBackground(Qt::red); Please also note that you should use setBackground instead of setBackgroundColor as the latter is Nov 28, 2022 · The section indicated in the image represents the cell that is in text editing mode and changes its background color to white. The coloring works, but all rows get colored, instead of the The simplest way to create the headers is to supply a list of strings to the setHorizontalHeaderLabels() and setVerticalHeaderLabels() functions. setPointSize(11) atable. QWidget(tabwidget) widget. Note2: The color of the border is the color of the grid on my system. But this may be enough of a starting point. Nov 3, 2017 · I have successfully used the following Qt code in my python application to color horizontal headers in a QTableWidget with distinct background colors: header2 = widget. What you have to do is reimplement QAbstractTableModel::headerData() . It clearly states that you try to color the header. How to set each item's selection color of QTableWidget in PyQt5. Sep 4, 2019 · The simplest fix is this: class AlarmWidget(QWidget): def __init__(self, alarm, parent=None): self. } will change background color of many other widgets, so it is not a solution. QtGui. horizontalHeader (). text() Or if cells are selected over multiple rows: Nov 7, 2021 · @mpergand said in How to change the background of QTableView header? Qt is not always consistent with itself :( It is - as stated in the docs the stylesheet always wins: "Note: If Qt Style Sheets are used on the same widget as functions that set the appearance of widgets, such as QWidget::setFont() or QTreeWidgetItem::setBackground(), style Mar 9, 2019 · I am trying to create a QTableWidget that has a thumbnail image in it's vertical header (and eventually some text under it). Also the property cellClicked is returning only row number. So wherever 'NO' is , I wish for background to be red . table. setData(0, QtCore. QPalette palette = horizontalHeader()->palette(); // Set the normal/active, background color. This works for me. The below solution worked for me: tableWidget->setFocusPolicy(Qt::NoFocus); But the problem is that, you can not work with keyboard for going up and down on the QTableWidget. It does this using two methods -- paintEvent; paintSection Jun 25, 2019 · I messed around with stylesheets for the check box (with selection-background-color) but it still doesn't do anything. background-color: #333333; class ExpressionForm(QFrame): def __init__(self, parent=None): super(). This delegate will check the foreground color role of the item. To apply this property only to your specific tableview just set some object name to it with. 2. QAbstractScrollArea. But the QTableWidget::item:selected{ background-color: } only works when there is only one item selected, otherwise all selected items will have the same selection color. In other words, in this case, keep the red background and the white text color If you want to display data arranged in a table, use a QTableWidget to do so, without dealing with much configuration. like this: QVariant Jun 30, 2020 · Get the background color of a widget - really. Then, for each mandatory field widget, we would simply create a mandatoryField property on the fly and set it to true. QAbstractTableModel. // Make a copy of the current header palette. Qt. May 29, 2014 · 1. I can't seem to call it correctly. Hello, I try to set a background color to my QTableWidget (particular celle or row) with setBackgroundColor. The problems are (1) I don't quite understand what this code actually is since I can't find it in the PySide2 documentation, (2) the code changes not only background but many header appearance features. verticalHeaderItem() with the table's current row. Supports the box model. How can that be done? pyqt. wrote on 1 Sep 2013, 22:21. asked Aug 31, 2021 at 8:55. So I think that solution is not good. currentRow() label = table. setFamily("Arial Black") afont. This function works with QTableWidgetItem but cr Mar 25, 2013 · So you need to populate your QTableWidget with empty items first. color(QtGui. EDIT: Either setting the border to 0px or setting the color to white would be good as well. I also tried ``` ui->tablewidget-item(row, column) ->setData(Qt::BackgroundRole, QColor (250,0,0)) Even that doesn't work. Note. First, make the background of the QWidget white: QWidget { background-color: #fff; } Code language: CSS (css) Second, change the color and font weight of the QLabel: QLabel { color: #464d55; font-weight: 600; } Code language: CSS (css) Third, change the color, font size, and margin-bottom of the QLabel with the object name heading: Sep 5, 2017 · One way to change the colors is to use a delegate. #12. The result that I expect to obtain is that the background and text color does not change when it enters editing mode. Jan 28, 2022 · Ask questions, find answers and collaborate at work with Stack Overflow for Teams. I am trying to change the background color of selected cell in a QTableWidget. background-color: red; color: white; Aug 2, 2019 · In PyQt5, I am using the model view to display a table. Also, changing the alpha channel, you can have a great effect on your table. I just work with QTableWidgetItem. Feb 20, 2021 · I use a QTableWidget, not QTableView. Note that you should be very careful with naming new attributes to subclasses as they might already exist. For example: QLineEdit *nameEdit = new QLineEdit(this); nameEdit->setProperty("mandatoryField", true); QLineEdit Aug 31, 2021 · 1. If this property is true a grid is drawn for the table; if the property is false, no grid is drawn. I've following code to change the header color -. background-color: green; }@. By default, a QWidget doesn't fill its background. For this we must get the current background color, the task of getting the background color is tedious since a QTableWidget has its own color as its background, it also has the colors that you add to QTableWidgets and other types of elements so my answer currently has limited support but the idea is scalable. horizontalHeader(). And something strange is happening, if I add an ; affter the first } then the color is working and the border is not set, if I remove the ; then the color is not working and the border is set. Setting a default-constructed brush will let the view use the default color from the style. Some will use the default coloring, others will get a different color. stylesheet = "::section{Background-color:rgb(190,1,1);border-radius:14px;}" Table. The line that begins "b4:e6" is the first row of data in the table. setStyleSheet("background-color: green"); To set a specific QStandardItemModel Item Background Colour this works for me: Dec 19, 2014 · 2. setFixedHeight(60) If you want to increase the font of the cells you must set the setFont() method of the QTableWidget: fnt = self. I cannot use stylesheets since I want to change the color of a specific row at runtime. Problem is, that it is hard to style QHeaderView. ui->tableWidget->setStyleSheet("QTableWidget { gridline-color: yellow }"); Jun 8, 2012 · The view draws the background based on the Qt::BackgroundRole role of the cell which is the QBrush value returned by QAbstractItemModel::data(index, role) for that role. palette() p. Any ideas on how to set the selection-color of my checkbox? Apr 25, 2012 · Using background-color: rgba(0,0,0,0); in your stylesheet, you can get a transparent table. font() fnt. __init__(parent) self. The header items are nothing more than QTableWidgetItems. Any help would be great. Obviously, if this is possible. setBackground(QtGui. horizontalHeaderItem(3) orange = QColor(237,168,89) header3 However, now Im trying to see if I can get rid of the lines between the headers of the same group. setFont(afont) If you want to see more families, you can always look at the available ones from QtDesigner. Oct 12, 2019 · I have a QTableWidget but I need to customize the rows so that they have spacing in between them and so that they have rounded corners. palette(). It is the source model's data() that sets each of `QTableView's indexes background colors to a green if the index's row number is even and to a blue if it is odd. Otherwise, this should do the job. Apr 4, 2014 at 22:57. I want to draw all grid lines with same color and same width. tableview colour based on certain value Jan 23, 2019 · What I tried next - self. Here is how to control Item's background color using a model. A QHeaderView displays the headers used in item views such as the QTableView and QTreeView classes. Mar 1, 2023 · wrote on last edited by. I can set the text color using: tabBar (). setFont(font) And I want to set/change the default blank/white color of these background. Base None of which gets the exact colour. The issue is that when I select a row, the background color of the complete row becomes the standard orange and the text color becomes white. These will provide simple textual headers for the table’s columns and rows. I prefer this over the popup from a user perspective. Sorry to bother you with C++ code but It should be easy enough to translate into valid pyqt code. I tried the code . Apr 4, 2014 at 22:50. red) Sep 8, 2011 · How can I set the cell borders in a QTableWidget to 0px? Preferably I can choose which sides of a cell's border to set to 0, but I can live with setting them all to 0 as well. When creating a new QTableWidget and changing the QPalette to the following QPalette: The result is that the horizontal background of the QHeader don't change the color: ps. It works! Jan 18, 2017 · For the fonts you can try to do the next. I was not successful into adding header May 23, 2019 · 1. palette() palette. I know how to make rounded corners using stylesheets, but I'm not sure how to apply stylesheets to a row in a QTableWidget and I'm also not sure how to put spacing in between the rows. mr5. The follow code sets the box for every day of the week in the HorizontalHeader to have a background color of cyan: QColor c = new QColor(color); Nov 13, 2020 · Following commands did not help setStyleSheet("QTableWidget{ border-color: green}") does nothing and setStyleSheet("QTableWidget{ border: 1px solid green}) results in "over formatting" as you can see in the attached image. Put the number in to get the result: 0:left 1:left 2:right 3:right 4:centre. How to get both row and column number? Dec 20, 2014 · QTableView is a QFrame, you should change color of whole frame, but of course next code: QFrame. Mar 9, 2016 · The cell background color seems to work with the above style, but now the border isn't showing anymore. QtWidgets import *. tableWidget. And you might consider QInputDialog. But if I can, I prefer change it on QTableWidget() Anyone could help me? Thank you! Sep 18, 2015 · F. setStyleSheet(stylesheet) That is if you want different horizontal and vertical headers. setStyleSheet (stylesheet Feb 19, 2011 · I believe with QTableWidget the easiest way setting row color would to iterate through widget items and use setData method to specify the background color, see an example below Aug 30, 2018 · If you want to increase the height of the horizontal header you must use setFixedHeight(), for example: self. I don't know if I can change it in general (in the own QTableWidget()) or I should change it in his QTableWidgetItem(). List of Stylable Widgets. QtGui import *. Is it possible to change color when clicked/selected and return to default color when not selected. How to make the background color the same as the form background? The most common suggestions to get the background colour is to use: widget. i want to set the color of vertical header in CSS. If this foreground color is not the default WindowText color of the palette, that means a specific color is set and this specific color is used for the highlighted text color. arg(. I added following code to add customized tooltip to my qtablewidget => ui. afont = PyQt4. {. ui. tblDinamic = QTableWidget() self. Detailed Description. Kamil. The following creates a table widget using the QTableWidget class: table = QTableWidget(parent) Code language: Python (python) With that solution, we are setting the background on an already existing item in the table to a light grey on the item at row 0, column 1: self. You can also create a data model and display it using a QTableView, but that is not in the scope of this tutorial. horizontalHeaderItem(0). want to change the color where blue arrow is marked. When you're done with searching set the default palette back. 2. But there is a stumble here because you don't know whether index is current or not. How to Style. QPalette. setStyleSheet("::section {" "background-color: lightblue; }") - I managed to change background color. I have the following window with one QTableWidget: and associated stylesheet: QWidget {. Sep 13, 2013 · I am trying to decrease the size of the font in horizontal header of a QTableWidget. import sys. So the resulted colors are all unordered. tableWidget = QTableWidget(self) self. If you just want to colour the background of the tab body, then set the background role of its top-level content widget: widget = QtGui. The relevant values for foreground (=text color) and background in Qt::ItemDataRole are Qt::BackgroundRole and Qt::ForegrondRole. void QTableWidgetItem:: setCheckState (Qt::CheckState state) Sets the check state of the table item to be state. CSS is used later for everything else: import sys, os. With setVerticalHeaderItem of QTableWidget you can set a QTableWidgetItem even for header rows and there you can define a background brush for each row. iu bz fj kl my wq gl ci sk yz