QTableView / QTableWidget grid style sheet - grid line width

I would like to display a table in Qt with a special style. I want to draw all the grid lines with the same color and the same width.

The problem is that it's hard to style QHeaderView. All the time I get a 2px mesh width or no mesh at all.

I have the following window with one QTableWIdget

QTableWidget

and asociated styleSheet

QWidget {
    background-color: #333333;
    color: #fffff8;
}

QHeaderView::section {
    background-color: #646464;
    padding: 4px;
    border: 1px solid #fffff8;
    font-size: 14pt;
}

QTableWidget {
    gridline-color: #fffff8;
    font-size: 12pt;
}

QTableWidget QTableCornerButton::section {
    background-color: #646464;
    border: 1px solid #fffff8;
}

Are there any tricks for all 1px grid lines? I am using 4.8.5 and I cannot upgrade to version 5.x.

+4
source share
2 answers

border-style: none; QHeaderView::section border-left, border-right, border-top border-bottom. QHeaderView::section

QHeaderView::section {
    background-color: #646464;
    padding: 4px;
    font-size: 14pt;
    border-style: none;
    border-bottom: 1px solid #fffff8;
    border-right: 1px solid #fffff8;
}

QHeaderView::section:horizontal
{
    border-top: 1px solid #fffff8;
}

QHeaderView::section:vertical
{
    border-left: 1px solid #fffff8;
}
+3

, , ( )

QHeaderView::section {
    background-color: #646464;
    padding: 4px;
    border: 0px;
    font-size: 14pt;
}

.

http://pastebin.com/svReqHr3

CSS ?

+2

All Articles