I've added a left and right padding to the header of the QTreeView using this QSS code:
QHeaderView::section{padding:7px 15px}
But the content of the columns is not aligned anymore with the headers.

How can I add a padding of 15px ( like in the header ) to the columns' content?
Edit: For some reasons I use delegates to draw the content of the QTreeView, that's why styling the QTreeView::item doesn't work ( like @svlasov suggested ).
painter.translate(15, 0) seems to fix this issue, but a weird effect appears when I select a row: the selection is not continuous.

Something like this:
QTreeView::item { border: 0px; padding: 0 15px; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With