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 branch drawing... missing branch?

QTreeView branch drawing... missing branch?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtreeviewqstyle
5 Posts 2 Posters 1.5k Views
  • 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 3 Nov 2019, 13:40 last edited by Dariusz 11 Mar 2019, 14:18
    #1

    Hey

    So I've run in to alittle bit of a hiccup...

    I'm using custom QStyledItemDelegate on my QTreeView, and I think it caused some issues...

    When I draw my items I'm missing alternativeBackgroundColors + vertical branch line without anything next to it...
    44253437-556f-47df-9bba-712efe42354c-image.png

    A standard QTreeView renders properly :
    9221096f-b47b-4607-b9d3-454038ace6e6-image.png

    I literally have no idea how to dig in to it... any hints? :- ))))

    TIA


    
    QTreeView::branch:has-siblings:!adjoins-item {
        background: white;
        border-image: none;
    	image: none;
    }
     
    QTreeView::branch:has-siblings:adjoins-item {
        background: white;
        border-image: none;
    	image: none;
    }
     
    QTreeView::branch:!has-children:!has-siblings:adjoins-item {
        background: white;
        border-image: none;
    	image: none;
    }
     
     
    QTreeView::branch:has-children:!has-siblings:closed,
    QTreeView::branch:closed:has-children:has-siblings {
        background: white;
        border-image: none;
    }
     
    QTreeView::branch:open:has-children:!has-siblings,
    QTreeView::branch:open:has-children:has-siblings  {
        background: white;
        border-image: none;
    }
    

    Running this code result in :

    e8dab571-c1be-4e25-901b-ba418ddb52a2-image.png

    I'm not getting any of the has-siblings:adjoins-item / etc items.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 Nov 2019, 18:25 last edited by
      #2

      Hi,

      A good starting point would be to share your delegate code. That way more eyes may spot what is going wrong.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 2 Replies Last reply 4 Nov 2019, 19:46
      0
      • S SGaist
        3 Nov 2019, 18:25

        Hi,

        A good starting point would be to share your delegate code. That way more eyes may spot what is going wrong.

        D Offline
        D Offline
        Dariusz
        wrote on 4 Nov 2019, 19:46 last edited by
        #3

        @SGaist QStyledItemDelegate paints that branch? :O I never did any call to paint in in paint() function, how/where does it paint? o_O

        1 Reply Last reply
        0
        • S SGaist
          3 Nov 2019, 18:25

          Hi,

          A good starting point would be to share your delegate code. That way more eyes may spot what is going wrong.

          D Offline
          D Offline
          Dariusz
          wrote on 11 Nov 2019, 18:32 last edited by
          #4

          @SGaist said in QTreeView branch drawing... missing branch?:

          Hi,

          A good starting point would be to share your delegate code. That way more eyes may spot what is going wrong.

          Hey

          Apology for the long delay. Had a wild run around the app hotfixing bunch of stuff...

          As far as I can tell adding this >

          QTreeView::branch {
              border-image: none 0;
              image: none 0;
          }
          

          Fixed the issue, no idea why :- ) Or what does the 0 at the end do...

          But it works :D - unless it breaks something else that I dont know about yet :D

          TIa

          1 Reply Last reply
          1
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 11 Nov 2019, 20:23 last edited by
            #5

            In fact, it's the QTreeView::drawBranch that handles that.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            3/5

            4 Nov 2019, 19:46

            • Login

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