Remove QListView background

前端 未结 2 1075
挽巷
挽巷 2021-01-21 07:36

I want to remove the background of my QListView so that the background below can be seen through. How can I do that?

I tried setAttribute(Qt::WA_NoSystemBackground

2条回答
  •  面向向阳花
    2021-01-21 08:03

    Don't forget that QScrollArea, which is base class for QListView contains "another" widget which is called Viewport. It can be accesed via viewport() method.

    To achieve transparency You can simply just call:

    viewport()->setAutoFillBackground( false );

    and depending on other setting (i.e. parent widget settings) You should see background.

提交回复
热议问题