0

I work on PyQt6, and for a long time I wonder how to change the colors of these cells? And do you know how it can be done in Qt Designer?

enter image description here

ᅠWOlF
  • 45
  • 4
  • Does this answer your question? [How to change Qtablewidget's specific cells background color in pyqt](https://stackoverflow.com/questions/18889015/how-to-change-qtablewidgets-specific-cells-background-color-in-pyqt) – Brock Brown May 22 '23 at 18:05

1 Answers1

0

Right click in table on QTdesdinger>changestylesheet then set table css how you want to modify it. for e.g.

QTableWidget {
    background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                                      stop:0 #F7F7F7, stop:1 #E8E8E8);
    gridline-color: #DDDDDD;
    selection-background-color: #E6F1FF;
    selection-color: #333333;

}
QTableWidget::item {
    text-align: center;
}
QTableWidget QHeaderView::section {
    background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                                      stop:0 #4876AF, stop:1 #286090);
    color: white;
    font-weight: bold;
    padding: 6px;
    border: none;
    border-bottom: 1px solid #355F8C;
    border-radius: 4px;
}

QTableWidget QHeaderView::section:second {
    border-top-right-radius: 24px;
}

QTableWidget::item:selected {
    background-color: #B3D7FF;
    color: #333333;
}
QTableWidget QHeaderView::section:pressed {
    background-color: #4F8BC9;
}



QTableWidget::item:hover {
    background-color: #E6F1FF;
}

enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Abhishek
  • 1
  • 2