[PyQt] qtreeview vs qtreewidget selection model?

Jordan Olson jorxster at gmail.com
Thu Oct 4 23:20:41 BST 2012


hey guys!

I'm pretty fresh to this mailing list, but looking forward to being
pointed in the right direction!

So here's what's happening. I'm implementing a custom QTreeView model,
and though I have it working pretty well, the one little peeve I
haven't figured out is the way it handles selection-
--any default list/table/tree widget that ships with PyQt (or most
windows managers for that manager) have it so that when you left click
on an unselected item, it *unselects* any other selection you have,
unless you hold down Ctrl or Shift. Follow?

But with my qtreeview widget, I've got it displaying my custom model,
but it handles selection via mouse a little differently- clicking
seems to merely toggle item selection, and left clicking on an
unselected item doesn't deselect already selected items as you might
expect.

Can you give me a tip as to what methods I should be looking at? I
have a hunch it has to do with selection Model, but can't figure out
how to alter/implement this in pyQt.

cheers!
-Jordan


More information about the PyQt mailing list