4

I cant find a way to theme the top left side of a QHeaderView. Maybe its part of QTableWidget, I cant tell... Example: https://i.stack.imgur.com/h2hq2.png

History {
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 black, stop:1 gray);
}

* {
    font: 500 12pt "Cantarell";
    color: rgba(255, 255, 255, 200);
}

QTableWidget {
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 black, stop:1 blue);
}

QTableWidget::item {
    hborder: 5px solid rgba(68, 119, 170, 150);
    background-color:rgba(68, 119, 170, 125);
}

QHeaderView, QHeaderView::section {
    background-color: rgba(128, 128, 128, 128);
}
demonplus
  • 5,613
  • 12
  • 49
  • 68
user1441947
  • 63
  • 1
  • 7

1 Answers1

8

The corner widget in a QTableWidget is implemented as a QAbstractButton and can be styled using the QTableWidget QTableCornerButton::section selector.

Warning: If you only set a background-color on a QTableCornerButton, the background may not appear unless you set the border property to some value. This is because, by default, the QTableCornerButton draws a native border which completely overlaps the background-color.

tableWidget.setStyleSheet("QTableWidget QTableCornerButton::section {"
    "background: red;"
    "border: 2px outset red;"
"}");
Meefte
  • 6,469
  • 1
  • 39
  • 42