QListView show text when list is empty

后端 未结 2 886
[愿得一人]
[愿得一人] 2021-01-18 17:38

I want to show some text (like \"No items\") when there are no items in QListView.
I tried to override paintEvent method of QListView, but it doesn\'t have any effect.

2条回答
  •  难免孤独
    2021-01-18 17:59

    If you use a QListView, you probably have a custom model containing data you want to display. This is maybe the best place to returns "No items" when your model is empty.

提交回复
热议问题