Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QTableWidget and QHeaderView CSS

I cant find a way to theme the top left side of a QHeaderView. Maybe its part of QTableWidget, I cant tell... Example: http://i.imgur.com/VmHHdan.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);
}
like image 909
user1441947 Avatar asked Mar 18 '23 18:03

user1441947


1 Answers

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;"
"}");
like image 76
Meefte Avatar answered Mar 25 '23 05:03

Meefte