Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Different layout on item in" listview
Qt 6.11 is out! See what's new in the release blog

[solved] Different layout on item in" listview

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ThaRez
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        ThaRez
        wrote on last edited by
        #3

        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...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved