[PyQt] Editing multiple items in QTreeView delegate

Zoltan Szalai defaultdict at gmail.com
Wed Apr 6 11:11:32 BST 2011


hi,

not sure its a good idea but i solved this kind of problem by sending a 
signal from the delegate which the view can catch and perform the edit 
on all the selected items. it works just fine here.

bests
Zoli


On 2011.04.06. 2:43, James Polk wrote:
>
> 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/20110406/90c0d11b/attachment.html>


More information about the PyQt mailing list