如何在标题中绘制正确的CSS边框?

mos*_*osg 3 css qt qt-designer

在图片表示对话框窗口中只有一个窗口小部件类QTableWidget.我的问题是标题的底部边框(红色方块,QHeaderView类)与左/右彩色边框重叠!我想要的是使红色方块部分正确查看,如绿色方块.

在此输入图像描述

这是Qt Designer我正在使用的CSS代码:

QTableView#tableWidget QHeaderView::section:horizontal
{
    height: 24px;

    border-style: none;

    border-left: 1px solid #ecedef;
    border-top: 1px solid #161618;
    border-right: 1px solid #b1b1b5;
    border-bottom: 1px solid #161618;

    background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f4f4f6, stop:1 #ceced6);
 }

/*
QTableView#tableWidget QHeaderView::section:horizontal:first,
QTableView#tableWidget QHeaderView::section:horizontal:last
{
    border-left-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f4f4f6, stop:1 #ceced6);
}
*/
Run Code Online (Sandbox Code Playgroud)

谢谢!


更新:这是缩放图片,以防万一...

在此输入图像描述

mos*_*osg 6

我已经明白这个东西是如何运作的!

方案:

QTableView#tableWidget QHeaderView
{
    /* draw the hole hor top & bottom line for the header */
    height: 24px;

    border-top: 1px solid #161618;
    border-bottom: 1px solid #161618;
}

QTableView#tableWidget QHeaderView::section:horizontal:first
{
    border-left-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f4f4f6, stop:1 #ceced6);
}

QTableView#tableWidget QHeaderView::section:horizontal:last
{
    border-right-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f4f4f6, stop:1 #ceced6);
}

QTableView#tableWidget QHeaderView::section:horizontal
{
    /* for each section draw ONLY left & right lines */
    height: 24px;

    border-style: none;

    border-left: 1px solid #ecedef;
    border-right: 1px solid #b1b1b5;

    background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f4f4f6, stop:1 #ceced6);

 }
Run Code Online (Sandbox Code Playgroud)

另外,结果数字看起来如何:

在此输入图像描述

无论如何,谢谢大家!