Probably the easiest approach is to hide grid and repaint it with size you need. For this you'll have to create own class which inherits QTableWidget and define custom paintEvent. Sample code:
void paintEvent(QPaintEvent *event)
{
QTableWidget::paintEvent(event);
QPainter painter(viewport());
for (int i = 0; i < columnCount(); ++i)
{
int start = horizontalHeader()->sectionViewportPosition(i);
QPoint from = QPoint(start, 0);
QPoint to = QPoint(start, height());
painter.drawLine(from, to);
start += horizontalHeader()->sectionSize(i) - 10;
from = QPoint(start, 0);
to = QPoint(start, height());
painter.drawLine(from, to);
}
for (int j = 0; j < rowCount(); ++j)
{
int start = verticalHeader()->sectionViewportPosition(j);
QPoint from = QPoint(0, start);
QPoint to = QPoint(width(), start);
painter.drawLine(from, to);
start += verticalHeader()->sectionSize(j) - 10;
from = QPoint(0, start);
to = QPoint(width(), start);
painter.drawLine(from, to);
}
}