Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved] Different layout on item in" listview



  • Hello
    As I understand it you can only attach one delegate/model. But is it still possible to have a listview show item with different appearances? I'd like to create a listview that displays a log of data, with all the data added with the same appearances, but also add "day" items showing where the day changes in the log, these with a different look. Kinda like the Qt designer widget box were the widgets are listed using one look (icon + name) and the widget "group" with another ("group name" with grey background). I would not like to use a tree, as in QT creator, but only a simple listview.
    Thank your! Best regards
    Richard



  • Well, you can just create a delegate that renders differently depending on the data in the item it is rendering, right? I mean, you could for instance use a data role in the model to make it easy for the delegate to distinguish the different types of items, and adjust the rendering you use based on that.



  • That was precisely what I wanted to know! Thank you! I'm having a hard time finding good tutorials on delegates ... most just explain the spinbox example, and can't seem to find information about more advance delegate graphics...


Log in to reply