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?
Asked
Active
Viewed 54 times
1 Answers
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;
}