How can I hide the borders of the cells in a QTableView?
-
Hi,
I'm using a QTableView with my own abstract data model. All works fine. But I would like to hide the lines between the cells. I can not find the methods to do that. -
Thx
I'm new to the stylesheet approach. I tried this to see if I can control the style:mTableView->setStyleSheet(QString("QTableView { border-color: red; border-style: solid; border-width: 1px; }"));
But that doesn't work. Is "QTableView" the correct selector?
-
I found out that this one works:
mTableView->setStyleSheet(QString("QTableView { gridline-color: red; }"));
But I can not find how to remove the grid.
How can I find out which properties can be controlled and with values are allowed?@Simmania said in How can I hide the borders of the cells in a QTableView?:
But I can not find how to remove the grid
Set same color for the grid as is used as background color, then the grid will not be visible.
-
That is not possible, because I want to color the background of the cells too (can be different per cell).
-
@Simmania Sinse you can use RGBA colors you can simply specify a transparent color for gridline-color (A channel set to0.0).
mTableView->setStyleSheet(QString("QTableView { gridline-color: rgba(255,0,0,0.0); }"));
-
I also found this one:
mTableView->setShowGrid(false);
And it works!
With the stylesheets there may be much more control possible, but I have a hard time finding out which selection class to use en what the possible properties are.
@Simmania said in How can I hide the borders of the cells in a QTableView?:
mTableView->setShowGrid(false);
This is easier of course :-)
-