[PyQt] Editing multiple items in QTreeView delegate

James Polk jpolk5001 at yahoo.com
Wed Apr 6 01:43:38 BST 2011


I have a curious dilemma I can't seem to find any information about in the docs...

I have a QTreeView and a delegate...
The items in the QTreeView have columns of similar data.  When I set the
selection behaviour to multiSelect (actually called ExtendedSelect) I can pick
a single column of numbers that all have either a "1" in them.  I can then
CTRL-click and change one of them from "1" to "0"...while all of them are still
highlighted/selected. 

What I want to do is to simultaneously change all of them from 1 to 0 in one fell swoop.
In the delegate though...if I try to use

    indices = treeView.selectedIndexes()

it of course doesn't know anything about "treeView"....how can I pass to the delegate
some variable that contains an address/pointer/reference to the QTreeView, so that I
can query all the selected items.  I'm trying to make this work in the "setModelData"
of the delegate.

Thanks,
-Jim




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110405/c4e9848b/attachment.html>


More information about the PyQt mailing list