开发者

How to customize the display of a QListView

开发者 https://www.devze.com 2023-01-07 11:52 出处:网络
I have implemented a list of users in my Qt program, using the model/view principle of Qt. My QListView displays a subclass of QAbstractListModel and so far this works just fine.

I have implemented a list of users in my Qt program, using the model/view principle of Qt. My QListView displays a subclass of QAbstractListModel and so far this works just fine.

Now I would like to customize the display of my user list (display the name on several line, add IP information, and so on: not really relevant, I ju开发者_高级运维st want something really custom).

I couldn't find anything in the Qt documentation regarding this: what are my options ?

Note: The items in the list do not need to (can't) be modified, if this can help.

Thank you.


You need to create a new item delegate class to handle the painting. Here is a good answer to a similar question.

0

精彩评论

暂无评论...
验证码 换一张
取 消