[PyQt] Question TreeView, delegates, and functions

Andreas Pakulat apaku at gmx.de
Wed Jan 12 07:39:42 GMT 2011


On 11.01.11 19:19:55, James Polk wrote:
> 
> Okay,..I gotta' good one for ya'll...lol
> 
> I have a TreeView displaying data,..it's supported by a 
> QStyleItemDelegate that's controlling the editing/display of various cells
> in the TreeView. There is a plainTextEdit window also in the main
> window. When a user makes a selection in the TreeView, 
> the "selectionChanged" function retrieves some data and displays it 
> in the plainTextEdit.  So far so good, right?
> 
> Okay, so when I double-click on a cell, the delegate properly
> shows me a comboBox,....I pick an item and hit return, and
> while the cell properly updates,...the delegate doesn't trigger
> "selectionChanged" in the TreeView, and in turn, doesn't trigger
> the text in the plainTextEdit box to be updated either.

Thats correct behaviour, the selectionChanged signal in QTreeView is
meant for when you change the selection, i.e. select an item that is
currently not selected. If you want to know when an items data changed,
you need to connect to the dataChanged signal of the model and do the
same update in that case, if the corresponding item is currently
selected.

Andreas

-- 
An avocado-tone refrigerator would look good on your resume.


More information about the PyQt mailing list