Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set QTableWidget cell's borders to 0px

Tags:

qt

qt4

How can I set the cell borders in a QTableWidget to 0px? Preferably I can choose which sides of a cell's border to set to 0, but I can live with setting them all to 0 as well.

EDIT: Either setting the border to 0px or setting the color to white would be good as well.

like image 435
wrongusername Avatar asked Sep 07 '11 21:09

wrongusername


2 Answers

You can disable all the borders with QTableWidget::setShowGrid, and re-enable some of them with a style sheet (for instance: "QTableView::item { border-left: 1px solid black; }")

The latter are cell interior borders, so they might not be as well aligned as the grid.

If you want to change the borders individually for each cell, you need to write a delegate (like in that answer).

like image 101
alexisdm Avatar answered Nov 28 '22 04:11

alexisdm


check if QTableWidget's setShowGrid would work for you, smth like this:

tableWidget->setShowGrid(false);

hope this helps, regards

like image 33
serge_gubenko Avatar answered Nov 28 '22 05:11

serge_gubenko