Well I found a solution and thought I would share it...
Probably not the most elegant, but it does work..

Works by using an import global variable (told you it wasn't elegant ;-)

I created a file named "ms.py" and inside is a single line:

     MyTreeView

and that's all.

In my main.py,...I "import ms" at the top.  Later, I set the variable by...

     ms.MyTreeView = self.treeView

Then in my delegate file, delegate.py, I also add "import ms" at the top.
And then later, in the setModelData() function,  after checking selectionMode()
to make sure it's in multiSelect,...and after handling the "main" selection,I 
do a

      indices = ms.MyTreeView.selectedIndexes()

and loop thru them setting their value to the value of the main selection...

A side note,...when a treeView's selectionMode is set to 3 (Extended Selection),
one can pull a vertical pick from top to bottom, highlighting multiple items in 
a single
column.  Then, while holding down CTRL, you can double-click selection one item
out of this group.  This will pass this CTRL-selection to the delegate and 
remove its
index from the "indices" returned above.  Which is good, so you don't double-set
it's value.  When you hit "enter", the code will take the value of the 
CTRL-selection
and apply it to all the others who are still highlighted, making a nice clean 
sweep
and saving lots of keystrokes if you need to change a lot of items.

Cheers,
-Jim
 
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to