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. Adjusting Indenting for QTreeView items

Adjusting Indenting for QTreeView items

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.6k Views 3 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
    Taytoo
    wrote on last edited by Taytoo
    #1

    Currently items in QTreeView appear as follows - in terms of indentation: Note -> = space and + = Expand/Collapse icon

    -> <icon><text>
    + Group Name
    -----><icon><text>
    

    How can I decrease indenting? e.g.

    <icon><text>
    + Parent Name
    --><icon><text>
    

    Note that the Item without a Parent still is indented but not as much as previously

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      You can try

      void QTreeView::setIndentation(int i)
      
      T 1 Reply Last reply
      1
      • B Bonnie

        You can try

        void QTreeView::setIndentation(int i)
        
        T Offline
        T Offline
        Taytoo
        wrote on last edited by
        #3

        @Bonnie Already tried it, but it sets identation for all items and end result isn't visually correct - or what I'm trying to achieve.

        mrjjM 1 Reply Last reply
        0
        • T Taytoo

          @Bonnie Already tried it, but it sets identation for all items and end result isn't visually correct - or what I'm trying to achieve.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Taytoo
          Hi
          Did you try a Delegate to paint it the way you like ?
          https://stackoverflow.com/questions/55969916/how-to-remove-qtreeview-indentation

          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