Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved QTreeWidget with Tristate

    General and Desktop
    qtreewidget tristate
    2
    3
    1601
    Loading More Posts
    • 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
      bcl79 last edited by

      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 Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        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 Reply Quote 0
        • B
          bcl79 last edited by

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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post