qabstractitemview

Clear selection when clicking on blank area of Item View

坚强是说给别人听的谎言 提交于 2019-11-28 14:28:50
I made a tree structure with QTreeWidget , and it works well. But I have a problem with that. Commonly, with a tree structure, if I want to deselect all, I click on a blank area of the tree-widget. But QTreeWidget does not seem to support that (or I can't find out how). Could sub-classing or something else solve the problem? Determining a click on a blank area seems the key to the solution, but I can't find a signal or anything. The example code below will clear the selection (and current item) when clicking on a blank area, or when pressing Esc when the tree widget has the keyboard focus. It

Clear selection when clicking on blank area of Item View

我的未来我决定 提交于 2019-11-27 08:27:19
问题 I made a tree structure with QTreeWidget , and it works well. But I have a problem with that. Commonly, with a tree structure, if I want to deselect all, I click on a blank area of the tree-widget. But QTreeWidget does not seem to support that (or I can't find out how). Could sub-classing or something else solve the problem? Determining a click on a blank area seems the key to the solution, but I can't find a signal or anything. 回答1: The example code below will clear the selection (and