Important: Please read the Qt Code of Conduct -

QTableWidget grid lines are misaligned

  • It appears that the grid lines in a QTableWidget are shifted one pixel down from the lines of the vertical header cells. I need to know how to make them line up properly.

    Version: Qt 5.4 on Windows 7 x64

    Repro Steps:
    -Create a new form, and place a QTableWidget on it.
    -Add a few dummy rows and columns.
    -Enable showGrid.

    Look very closely where the vertical headers border the cells in the first column. The header lines are one pixel above the cell lines. I've linked a picture via Google Drive which highlights the problem.

    "Table Grid Lines":

    This is something that I've noticed for a couple of years. If it's not fixable, then I'll file a bug.


  • Moderators

    i think it ever has been like this.
    This would need to be fixed in the painting code inside QStyle. But to be clear if there is maybe a reason for this you should ask this question on the "dev-mailinglist"

  • I figured I'd ask it here to see if it's the intended effect or if it's a bug, and if others have seen it, and maybe have a workaround for it.

    If not, I'll try the dev list. It just seems strange that something so blatantly obvious would be there for this long. I have a hard time believing I'm the only person who noticed that the grid lines are not aligned to the header cells.

  • Moderators

    well, some people may see it as intended since it adds an effect like the header widgets are raised above the view's content

Log in to reply