[PyQt] How to deselect all items in a Tree Widget

Marc Nations mnations.lists at gmail.com
Tue Feb 10 22:29:16 GMT 2009


Hi,
I have a Tree Widget where the user has the ability to add items at any
level. The problem is when they select an item there's no easy way to
deselect them. I need the ability to return the tree to an initial state
(where no item is currently selected).

There appear to be a couple of ways to do this. Either have them push a
button which selects the invisible root widget or setCurrentItem(None).
However this still requires them to push a button to cause this too happen.
I'd like there to be a more intuitive way of deselecting.

I've tried unsuccessfully to find a signal that would fire whenever the user
clicks in the open space in a tree widget area which does not contain an
item widget. All various forms of 'click' don't seem to respond and the
native functionality is to select the first item. Is there a better way to
do this?

Thanks,
Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090210/6b442825/attachment.html


More information about the PyQt mailing list