How to set the padding of QTableView cells through CSS?

后端 未结 2 693
别那么骄傲
别那么骄傲 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:48

    I managed to get it to work using the ::item sub-control specifier as follows:

    QTableView::item
    {
      border: 0px;
      padding: 5px;
    }
    

    Note that setting the border property here is necessary to get this to work. Also, this is not super ideal, since it only seems to influence the left and right padding of the QTableView cell. I can live with it for now though.

提交回复
热议问题