Ah, cheers Andreas, figured it out! I was setting it to self.treeWidget.setSelectionMode( QAbstractItemView.MultiSelection ) but what I really wanted was self.treeWidget.setSelectionMode( QAbstractItemView.ExtendedSelection )
thanks again! On Fri, Oct 5, 2012 at 11:46 AM, Andreas Pakulat <ap...@gmx.de> wrote: > Hi, > > On Fri, Oct 5, 2012 at 12:20 AM, Jordan Olson <jorxs...@gmail.com> wrote: >> 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. > > No, the selection-model only keeps track of the selected indexes. > Which indexes are being selected upon clicking (with or without > modifiers) depends on the selection mode of the QTreeView (this > propery comes from the base class QAbstractItemView). IIRC the > behaviour you want is called ExtendedSelection in Qt. > > Andreas _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt