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. Can I Customize QTreeView this way?
Forum Updated to NodeBB v4.3 + New Features

Can I Customize QTreeView this way?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.5k 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.
  • L Offline
    L Offline
    leonidwang
    wrote on last edited by
    #1

    I've built a model for QTreeView, now it's time to customize QTreeView, to display items in a "fancy" way.
    For example, I'd like each tree item looks like this:

    !http://i.6.cn/cvbnm/e0/d8/8d/3e562af00fd58ba8a7da96cd6a58cabc.png(mockup)!

    Basically, I want a icon on the left, some texts of different font sizes, a progress bar...
    When double clicked the parent item(i.e. expanding treeview), child items will be displayed in similar way.

    I don't know how to render items in the way I wanted, what's worse, I'm not sure where to get started.
    I've tried a very simple QItemDelegate from the Qt SDK examples, but it is not enough.

    Any suggestion, reference link will be appreciated, thanks.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Yes, a delegate is definitely what you want. Subclass QStyledItemDelegate and do your custom painting there.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      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