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. QTreeWidget with Tristate

QTreeWidget with Tristate

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

    I need to implement a QTreeWidget with group nodes and leaf nodes. I want only the group nodes to be in tristate mode. I set the group nodes to tristate mode using setflags(..) which is not done for the leaf nodes. When I run the code, clicking the checkbox cycles through all three states not just check and unchecked as desired. I've also tried setting Qt::ItemNeverHasChildren for the leaf nodes but it has no effect. What have I missed? Thanks for the help.

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

      Hi, welcome to devnet.

      Flags are propagated to the children so you can either set all wanted flags on the child explicitly to overwrite whatever came from the parent, or unset just the tri-state flag on the child.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bcl79
        wrote on last edited by
        #3

        That worked. I knew it had to be something simple. Thanks.

        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