Click and double-click event handling for QTree

  • I need help with a couple of things related to QTree.

    The first has to do with the click behavior of the tree. Assuming one clicks only on one specific node, the first click selects it, the second click deselects it. I need a different kind of behavior: 1st click selects it, and the second and subsequent clicks are ignored (the node stays selected). The only way the selection changes is if the user clicks on some other node. How can I simulate this behavior?

    The second issue I have is detecting double-clicks. I know that Vue, in general, has an issue with not emitting any double-click event, but one can simulate them using a timer and the click event. However, the QTree does not issue the click event, so that is not possible. So, how do I handle a double-click on a tree node?

  • You might be better off using QList or QMenu, if “clicking” is your goal. 😄


  • Scott,

    You’re right, given the way the QTree behaves, I might need to build my own with QList and QExpansionItem.


Log in to reply