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



  • 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?



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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.