How to set the padding of QTableView cells through CSS?

后端 未结 2 705
别那么骄傲
别那么骄傲 2021-02-19 17:00

Is it possible to define the padding of QTableView cells? I would expect this to be possible using CSS stylesheets, but the documentation does not describe a method to do this.<

2条回答
  •  孤街浪徒
    2021-02-19 17:30

    I know this is an old question but I've been struggling with this recently.

    I found out that by setting

    tableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    the padding set in your CSS will then be applied to the top and bottom of the cell, too!

提交回复
热议问题