After hiding the header in the qtablewidget, the left and top borders display abnormally
-
Hi,
What about customizing the items? Something like this:
QTableWidget::item { border: 1px solid white; }But this will change all items.
Without this stylesheet:

With this stylesheet:

Note: this is not the grid line, but the items' borders, so it's a workaround.
An actual solution would probably require setting a margin for whatever contains the view, I couldn't find out how to do that, as neither setting the table nor its viewport's margins worked.
-
Hi,
What about customizing the items? Something like this:
QTableWidget::item { border: 1px solid white; }But this will change all items.
Without this stylesheet:

With this stylesheet:

Note: this is not the grid line, but the items' borders, so it's a workaround.
An actual solution would probably require setting a margin for whatever contains the view, I couldn't find out how to do that, as neither setting the table nor its viewport's margins worked.
@Abderrahmene_Rayene Thanks for your reply.
In the end, I used CustomiDelegate, and the stylesheet of the table usually needs to be added with " "QTableWidget::item { padding:1px; }QTableWidget { gridline-color: #303030; }"class CustomDelegate : public QStyledItemDelegate { public: CustomDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) {} void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override { painter->setPen(QColor(0x303030)); if (index.row() == 0) painter->drawLine(option.rect.topLeft(), option.rect.topRight()); if (index.column() == 0) painter->drawLine(option.rect.topLeft(), option.rect.bottomLeft()); QStyledItemDelegate::paint(painter, option, index); } };
