Qt Forum

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

    Qt Academy Launch in California!

    Solved How can I handle the columns of a QTreeWidgetItem as a single entity?

    General and Desktop
    qtreewidget qtreewidgetitem qt5
    1
    3
    807
    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.
    • J
      Jakob last edited by

      I have some read-only data that is displayed in a QTreeWidget. Each column shows a parameter for an item. The idea is that it is possible select or deselect an item for subsequent processing.

      Because the different columns reflect just a set of parameters for each item, I'd like the user interaction to be such that when the user selects one item, all the columns are selected. In other words, I'd like the same behaviour one gets when I do setFirstColumnSpanned(true), but without losing the display of the data in the extra columns.

      Additionally, I'd like that the checkbox in the first column toggles, independent of where in the item the user clicks. When I simply enable the checkbox, the user has to click precisely on the checkbox in order to toggle it. Instead I'd like the checkbox to be toggled if the user clicks in any of the columns, as long is it is in the row of the item (essentially like clicking the text next to a checkbox also toggles the checkbox)

      How do I achieve these things?

      1 Reply Last reply Reply Quote 0
      • J
        Jakob last edited by

        I should have mentioned that I already tried different settings for SelectionBehavior, but changing that value didn't seem to have any effect whatsoever.

        1 Reply Last reply Reply Quote 0
        • J
          Jakob last edited by

          After disabling a whole bunch of Windows policies suddenly I get the desired behaviour.... that is surprising. I still don't know the root cause, but I'll postpone looking further until the problem reappears

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