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. QTreeView column sizes
Forum Updated to NodeBB v4.3 + New Features

QTreeView column sizes

Scheduled Pinned Locked Moved General and Desktop
qtreeviewcontentssize
3 Posts 2 Posters 2.0k 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.
  • G Offline
    G Offline
    gusa
    wrote on last edited by
    #1

    Standard implementation of QTreeView draws elements so that they have a table layout. As a result i get unnecessary spaces between elements, when i expand branches(example). How do I get QTreeView to draw rows without spaces between the elements, as if they are one solid element(example)?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You could make the colored dots to be returned for Qt::DecorationRole of the first column in your model, instead of being a separate column. this way they become part of the item and it gets indented as a whole.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gusa
        wrote on last edited by
        #3

        The thing is, that i need this dots to be separate items, since they are used as clickable buttons. I tried to inherit from QTreeView and override drawRow, but when i do that, i need to override visualRect, indexAt and some other methods too, and that's realy inconvenient. Is there another way to reach my goals with QTreeView , or do i need to inherit from QAbstractItemView, and implement this kind of TreeView myself?

        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